Git Product home page Git Product logo

stumpy's Introduction

STUMPy

Mutaku URL Shortener

WHAT IS STUMPY?

STUMPy is a URL shortener written by xiao_haozi (Mutaku) using the django python web framework.

WHY STUMPY?

There are many url shorteners out there, and STUMPy does not do anything groundbreaking.
However, there are several benefits that encouraged it’s development:

  • you keep all the data and can access it at your will
  • you keep all the code and can access/change it at your will
  • simple to use, simple to run, and simple code
  • because of it’s simplicity, it is easy to understand how url shorteners work and some of the possible optimizations
  • uses the django framework which allows for easy expansion, management, and tweaking
  • django also allows for a nice web UI for administration of all of the data

REQUIREMENTS:

{requirement [link for source]}

INSTALLATION, SETUP, AND TESTING:

See: Django Install
Once you have django installed and running, you can checkout the repo and test things out in a few steps.

  1. Grab the latest release with git.
    git clone https://[email protected]/mutaku/Stumpy.git
  2. Setup a mysql database that stumpy can access.
    create database stumpy;grant all on stumpy.* to ‘SOMEUSER@localhost’ identified by “SOMEPASS”;flush privilieges;
  3. Copy the local_settings.py.dist file to local_settings.py .
    cp local_settings.py.dist local_settings.py
  4. If you do not have a SECRET_KEY generated in Django you will need to generate one by running the keygen script and copy that key into your local_settings.py file in the next step.
    python gimme_key.py
  5. Edit the local_settings.py file and add in your appropriate database variables and your secret key you already had from django or the one you generated above.
  6. Sync the database to the models.
    python manage.py syncdb
  7. Fire up the server and navigate to /admin in your browser. Go to sites→sites and edit the domain name to match the domain you are using. This will initially be set to ‘example.com’.
    python manage.py runserver

PRODUCTION RUNNING:

See: Deploying Django
Once you have your webserver setup to serve the static files, you can set DEBUG=False. Without doing so, static files will not be served up by Django in production mode (DEBUG=False).
Additionally, ensure that you have set your proper FQDN through the admin interface as mentioned in the last step of the setup section.

I have included an example fastcgi script (stumpy.fcgi) that you may point to with your webserver to run Stumpy in a production setting.
The following is an example of a stanza that you could use with Lighttpd to serve up Stumpy.

$HTTP["host"] =~ "example.com" {
  server.document-root = "/home/JohnDoe/Stumpy/"
  fastcgi.server = ( ".fcgi" =>
                     ( "localhost" => (
             "socket" => "/var/lib/lighttpd/stumpy-fastcgi.socket",
                         "bin-path" => "/home/JohnDoe/Stumpy/stumpy.fcgi",
                         "check-local" => "disable",
                         "min-procs" => 2,
             "max-procs" => 4,
                       )
                     ),
                   )
  alias.url = ( "/static/admin"  => "/home/JohnDoe/django/contrib/admin/media/" )
  url.rewrite-once = ( "^(/static/.*)$" => "$1",
                       "^/favicon\.ico$" => "/static/favicon.ico",
               "^(/.*)$" => "/stumpy.fcgi$1" )
}

USAGE:

You will probably be able to see from the urls.py how to go about using Stumpy. Here’s the rundown:

  • [site]/ → index view (recent stumps, popular stumps, and the bookmarklet)
  • [site]/[shorturl] → grab shorturl and redirect
  • [site]/register → register new user [for users – admin can add through admin interface]
  • [site]/admin *→ admin interface
  • [site]/url/[longurl] *→ shorten url [this is how the bookmarklet does it] [needs to be escaped if not using bookmarklet]

*→ These views require authenticated_user and uses sessions

NOTES:

A bookmarklet is ready to use and can be found by visiting the index page (“/”) and dragging the ‘stumpy it!’ link to your bookmarks bar.

To add additional users that may submit URLs, add the user via the admin interface. They do not need to have any admin interface abilities to simply login and and submit URLs.
If you want a user to have permission to edit and delete urls (why?) you would have to enable those permissions in the user management in the admin interface.

FAQ:

[coming soon]

HELP:

Most of the information you might need can be found in the Django docs here: Django
For Stumpy specific help, see Stumpy

stumpy's People

Contributors

mutaku avatar aaronr avatar sublevo avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.