Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Django project template

This is the template I use for my projects.




To create a project using this template:

mkvirtualenv -p python2 project_name
workon project_name
pip install Django startproject --template= --extension=py,rst,template project_name
cd project_name

Then follow the instructions in the README file.

What follows is the README for projects created using this template.

{{ project_name|title }}

Setting up

cd /path/to/project
add2virtualenv .
gem install bundle
bundle install
pip install -r requirements-dev.txt
createdb -U postgres {{ project_name }}
make syncdb
make test


  • Running the development server & compass:

    foreman start

    If you need more processes (queue workers, stub mail servers or other things), add them to the Procfile.

  • Running the tests:

    make test

    Tests are located in the tests/ directory. Create files at will, the test runner will auto-detect tests if the file names begin with test.


This template uses environment variables for configuration and application secrets. The required environment variables are:

  • SECRET_KEY: the secret key for Django
  • DATABASE_URL: a heroku-like database URL.

Optionally you can use:

  • DEBUG: set it to something non-empty to switch to a development environment. Obviously, don't set it in production.
  • SENTRY_DSN: your DSN for sending exceptions and 404's to Sentry.
  • REDIS_URL: a heroku-like URL to configure redis. If you set it, redis will be used as a cache backend and the message and session storage engines will use it whenever possible.

Environment varibles are defined using the env directory. To set an environment variable, add a file to the env directory with the appropriate content. When you run any command in your project, reads the files in env and exposes them as environment variables.

This replicates the behaviour of Daemontools's envdir program, which you can use in production to set environment variables properly.


Do not use foreman to deploy apps created this way. Run sdist, export the distribution to your own PyPI server and use pip to install it on your production machines. Or convert the python distribution to a system package if you prefer.

Use daemontools's envdir program to manage application secrets (SECRET_KEY, DATABASE_URL, SENTRY_DSN, etc.).

Use a process watcher such as supervisor or circus to run the web server. Example:

envdir /path/to/config /path/to/env/bin/gunicorn {{ project_name }}.wsgi -k gevent -b -w 2

The combination of envdir and an installable package makes it extremely simple to automate your deployments.


The project template I use for my Django sites







No releases published


No packages published