1. hekevintran
  2. fastdev-django


fastdev-django /

Filename Size Date modified Message
culebron-hamlpy [f5cb274a09dc]
681 B
132 B
123 B
632 B
9.7 KB
1.8 KB
3.9 KB
6.3 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)

Credits for the initial contents of this package go to:


Clone the project:

$ hg clone https://hg.bitbucket.org/siberiano/fastdev-django

Bootstrap & buildout (internet connection needed during the procedure):

$ mv fastdev-django my-project
$ cd my-project
$ make buildout


After running bootstrap and buildout, the project is ready to run a Django development server.

Important: in this environment, use bin/django instead of manage.py.

$ bin/django runserver


$ make run
Validating models...

0 errors found
Django version 1.3.1, using settings 'project.development'
Development server is running at
Quit the server with CONTROL-C.

To add, remove or change the packages, run buildout again:

$ bin/buildout


$ make buildout


  • Python 2.5+
  • Ruby 1.8+ (for Sass)
  • SQLite 3 or any database of choice

All the other packages are bundled in the buildout script.


  • bootstrap.py

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
  • PuDB

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()
  • django-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.

  • HamlPy

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.name
                    = 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.