Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A utility and default classes for the Tornado Web Project
Python JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Torn is a series of utilities and helper classes for the Tornado Web project ( It is designed to create a base project structure conforming to the VC part of MVC, and provide a few helpful classes.


The Torn project, and many of its crucial pieces, was originally thought up by @nod ( Much of the code (torn.routes, the settings module, etc.) are "borrowed" or inspired by his tornado_addons project ( and his default setup(s).

The script, and the way it functions, is also "borrowed" (quite obviously) in concept from the Django project.


  • Python 2.6 (the torn.route uses class decorators)
  • Tornado (can be install with pip / easy_install)
  • PyCurl (only necessary if you are doing asynchronous work)


Simply git clone the project and run the tests with nose in the root directory:


Assuming these pass, run the following to install:

python install

(Depending on the environment, sudo may be required.)


The torn project comes with a "" script that should be installed to the bin/ of your environment. You should be able to create a project like: create path/to/new/project/

(The path must not exist.) To start the instance, just do: start path/to/new/project/

...and it should start a server on the default port (which is 8080). You can pass in parameters as well. For example, to override the port on the command line: start path/to/project/ -p 8081

To see the options of any command, just run: COMMAND -h

Here are some of the options for the create command:

Usage: create [options] <project_directory>

  -h, --help            show this help message and exit
  -c COOKIE_SECRET, --cookie_secret=COOKIE_SECRET
                        the default cookie secret
  -a APP, --app=APP     the app module name (default 'app')
  -p PORT, --port=PORT  the default port (default 8080)


All default settings should be entered in project/app/ . However, if you need to override any of these settings, whether in a development or production enviroment, you can create a project/ file which will automatically be imported. This is designed so that the app/ file can be under version control, and all mission-critical or deployment settings don't have to be.

An example project/ should look like:

settings = {
    "port": 8081,
    "address": "",
    "secret_key": "foobarsecret"


Torn has a lot, a LOT of potential directions. In the very short term, we need to flesh out the to see what other useful commands it can perform. I really would like to add a form creation and validation handler (with plug-in Javascript for client-side validation). And perhaps one of the NoSQL databases can be supported by default (Mongo, Couch, etc.)


If you use this project, we'd love to hear about it, whether it's bugs, feature requests, etc. You can throw out an issue on GitHub if you are having difficulty, or you can catch us at the torn mailing list:

Something went wrong with that request. Please try again.