Clone wiki

fastdev-django / Home

На русском


Fast Development Setup for Django

This project is a template for fast creation and development of Django websites. It contains all the tools that I know that allow fast coding, debugging and quality control.

When you add packages to buildout.cfg to be used in your project, any collaborator will get them just by running buildout script. No need to compare packages setups and versions, no need to use virtualenv.

With this setup, right away you have

  • extensions and a better shell
  • debugging tools (PuDB, Werkzeug, Debug Toolbar)
  • fast templating tools (HAML, SASS)
  • code quality tools (pyflakes, pep8)
  • useful packages (reversion, tastypie, annoying)

Credits for the initial contents of this package go to:


Install the following libraries in your system:

  sudo apt-get install libxslt-dev python-dev libpq-dev rubygems make openjdk-6-jre-headless --no-install-recommends

If your OS is not Debian/Ubuntu/Mint, copy the names of these libraries and install them with your package manager.

Clone the project and disconnect from this repo:

    hg clone yourproject
    rm yourproject/.hg/hgrc

See also instructions for CoffeeScript.


    cd yourproject
    make run

Changed packages in buildout.cfg? Updated django.po in locales? Just stop the server and do make run again. The make shell_plus command is also smart and can re-build bin/django should you change the dependencies in buildout.cfg.

Read "Makefile and Less Keyboard Banging in Shell" for more information.

Important: in this environment, use bin/django instead of It's a script, assembled by buildout, that connects the project environment packages.


  • Python 2.5+
  • Ruby 1.8+ (for Sass)
  • A database of choice

All the other packages are bundled in the buildout script.


Installs zc.buildout script.

IPython and django-extensions

A better Python shell with code completion and scripting. The extensions package adds shell_plus command that runs IPython. There's a shortcut for it:

    make shell_plus


A debugging environment for Python, which looks like the good old QBasic or Borland IDEs from the '80-s.

To use it, add this line in the code where you need to debug:

    import pudb; pudb.set_trace()


A toolbar that is embed into pages that shows you the list of rendered templates and their contexts. Enable its middleware and see a clickable label on the right in pages.


An elegant markup language that transforms into HTML. HamlPy implements HAML and a similar notation for Django template language:

    - extends 'base.html'
    - load i18n
    - block body
            - trans 'Hello'
                - for item in menu
                        %a{'href': "{% url item.get_absolute_url %}",
                            'title': "{{ item.title }}"}=
                        = item.description

            - trans 'See you'

Django Compressor and Sass

Compressor can be used to transform and compress CSS and JS on the fly. Here it is used to convert SASS stylesheets in valid CSS. Usage (Haml notation):


    - compress css
        %link{'href': '{{ STATIC_URL }}css/screen.sass',
              'rel': 'stylesheet', 'type': 'text/sass',
              'media': 'screen,projection'}
    - endcompress

Sass stylesheet screen.sass:

    @mixin border-radius ($radii)
        -webkit-border-radius: $radii
        -moz-border-radius: $radii
        -ms-border-radius: $radii
        -o-border-radius: $radii
        border-radius: $radii

        background: #88f
        +border-radius(1.5em)  // will expand in rules for all vendors

A not included feature: it can parse script tags in the page, open the JS files, minify them and pack into one single file.


If you want to use CoffeeScript, do the following:

  • edit Makefile and uncomment the line run: bin/coffee
  • set USE_COFFEE_SCRIPT = True in
  • if you use Ubuntu, make sure curl is installed (by default it is not):
    sudo apt-get install curl

You DON'T NEED Node.js, nor npm for this project to run CoffeeScript. Buildout will install them automatically. This makes it easier to deploy in web hosting.


In the bin folder, <settings name>.wsgi script will be created. (django and prod, as in buildout.cfg.) Connect your Apache or Nginx to this wsgi file.

To update WSGI script (after adding packages to buildout.cfg), just run make bin/django.