fastdev-django /

Filename Size Date modified Message
djaml → [d2f5324ef8dc]
731 B
119 B
113 B
1.4 KB
9.7 KB
2.9 KB
244 B
54 B
5.4 KB
8.1 KB

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:


  • Python 2.5+
  • rubygems (for Sass)
  • libxml-dev, libxslt-dev
  • Database of your choice
  • Java Runtime (without JDK/GUI)

Install these libraries in Ubuntu with this command:

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

All the other packages are bundled in the buildout script.


Clone the project:

hg clone yourproject
rm yourproject/.hg/hgrc

If you want to use CoffeeScript, read section "CoffeeScript" below.


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.


While developing, you may need to quickly recreate the database from scratch and reload fixtures. Fastdev-django has a command for this:

make rebuilddb

It will drop the db and run syncdb again.


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()

Debug Toolbar

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.