1. Zachary Voase
  2. django-in-a-box


django-in-a-box / docs / quickstart.md


Begin by installing Paver on your machine:

easy_install Paver

Then, create a directory to hold your site:

mkdir MyProj
cd MyProj/

Copy the Django-in-a-Box skeleton project to a sub-folder within this directory:

cp -R $DIAB_PROJECT/ ./myproj/
cd myproj/

Create and run the bootstrap script:

paver boostrap
python start.py

This will download all the required packages from PyPI, initialize a virtualenv and make the necessary directories throughout your project and site. Take a look through the options section of the pavement.py file in the project and make sure all the settings are correct, then run:

paver generate_config -d development

To generate all the configuration files for a deployment called development. Now edit etcs/development/lighttpd.conf, and uncomment the lines with server.bind and server.port so that the server runs on localhost, port 8001 (otherwise you would need to run lighttpd as root).

If you want to use the Django admin, edit the settings/common.py file and uncomment the line under INSTALLED_APPS. You can also play around with the settings in settings/common.py and settings/development.py; the common settings are those which will remain constant across all deployments of the site; development.py is for development deployments only, and as such contains settings for the database, cache, etc.

When you're happy with your configuration files, run:

ln -s `pwd`/etcs/development `pwd`/etc

to make a symlink in the project directory from etc to the etcs/development directory. Run:

. ../bin/activate
export DJANGO_SETTINGS_MODULE=myproj.settings.development

to activate the virtualenv, and let Django know that you're using the development settings. Then run:

paver manage syncdb

to create your SQLite database (which will be in db/development.sqlite under your site directory). You can now run:

paver manage runserver

to run a development web server on port 8000, or run:


to start Supervisor, which will run an instance of lighttpd with five FastCGI worker processes on port 8001. To stop Supervisor, run:

supervisorctl shutdown

You can also restart lighttpd with supervisorctl restart lighttpd, and you can restart the FastCGI processes with supervisorctl restart django:*. For more information, consult supervisorctl --help.