Skip to main content

Buildout recipes for django development

Project description

© 2014 Thomas Khyn

Buildout recipes for django development


The recipes available in djangorecipebook are mostly derived from djangorecipe’s functionalities. However, while djangorecipe aims at generating all scripts in one part, djangorecipebook enables you to define one part per script (create, manage, wsgi, test), hence allowing the use of different settings and/or eggs for each part.

djangorecipebook works with django 1.4 to 1.7 and relevant python versions (2.6 to 3.4, depending on django version).

Available recipes

Creates a management script for the project
Creates a wsgi script for the project
Creates a fcgi script for the project
Creates a script that invokes test [apps]
Creates a django project from a user-defined template or using django’s startproject management command. This recipe will not generate any script. The name of the created project is the name of the section.


Common options


The directory where the project files lie, relative to the buildout.cfg directory.

Defaults to '.' (buildout directory).


The settings module to load, imported from the project directory.

Defaults to 'settings'.


Paths to add to sys.path in the generated script.

Defaults to [].


Any environment variable that need to be set for the test run, one per line, under the form VARIABLE = value (spaces are tolerated).

Defaults to no environment variable set.


Some (basic) python initialization code to insert in the generated script. Don’t forget that leading whitespaces are stripped.

Defaults to ''.

Manage options


Any command-line argument you wish to have added to the generated script, separated by spaces or line-breaks.

Defaults to no arguments.

WSGI and FCGI options


The path to a log file where all stdout and/or stderr data should be redirected to.

Defaults to '', which disables logging


The level to log errors for. Can be one of INFO (stdout + stderr) or ERROR (stderr only).

Defaults to INFO.


The virtualenv that should be used to run the wsgi/fcgi script. This requires virtualenv and virtualenvwrapper, as it relies upon the WORKON_HOME environment variable.

Defaults to '', which disables any virtual environment setup.

Test options

See Manage options.

Use this option if you are using nose (and therefore django_nose) to test your Django app or project. This will simply include django_nose and nose in your buildout.

Defaults to unset.


The names of the apps that should be tested, separated by spaces or line-breaks.

Defaults to all the apps defined in INSTALLED_APPS

Create options

In create mode, the following common options are unused:

  • extra-paths
  • initialization

The settings import path must be set as it is used to determine whether the project has already been created or not.

The following options are added:


The directories in which to search for user-defined project templates. This option may also be added in a [djangorecipebook] section (for example in the default.cfg file). See the Templates discovery section below.

Defaults to the built-in templates directory, containing default django project templates.


The template that should be used.

Defaults to the standard django project for the major version of django you are using.


The SECRET_KEY to be used in the created settings file(s).

Defaults to a randomly generated alphanumeric key.

For more details on templating, see the Templates section below.


In create mode, a templating engine is available for greater personalisation of your django project initialization.

Templates discovery

If a template-dirs option is found either in the recipe section or in a specific djangorecipebook section, the recipe searches in these directories - from the last defined to the first - for a subdirectory name matching the template name provided.

If the search is unsuccessful or if none of template-dirs or template are defined, the recipe uses the default template for the major version of django being used.

For example, if in ~/.buildout/default.cfg you have the following lines:

template-dirs =

And your buildout.cfg contains this section:

recipe = djangorecipebook:create
template-dirs = /my/other/template/dir
template = mytemplate

The recipe will search for a mytemplate directory in that order:

  1. /my/other/template/dir
  2. /my/project/template/directory2
  3. /my/project/template/directory

Template engine

The template engine is as simple as it can be and relies upon pythons’s string.Template. A variable can be inserted in any file or directory name or file content in template directory using the syntax ${variable}.

The following variables are available:

  • any user-defined recipe option from the configuration file
  • secret: the secret key for django settings
  • project_name: the project name (= the section name)
  • year: the current year
  • month: the current month
  • day: the current day of the month

For example, if you have in buildout.cfg:

recipe = djangorecipebook:create
template = mytemplate
author = Thomas Khyn

for a copyright notice in a module docstring, you may use:

(c) ${year} ${author}

which will produce to the following output in the final file (if we are in 2014):

(c) 2014 Thomas Khyn

or, if you have a directory named ${project_name}_parameters, the final name will be mynewproject_parameters.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for djangorecipebook, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size djangorecipebook-1.1-py2.7.egg (29.8 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size (21.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page