This is a fork of Zachary Voase's django-szkel-project which is based of his blog post “[Django Project Conventions, Revisited][blog post]”.
- Designed to work with virtualenv and pip from the start.
- Django Debug Toolbar installed as standard.
- Fabric installed as standard with basic fabfile.py.
-
Logging set up with sensible defaults as standard.
-
Clean implementation of ‘settings modes’; have a single ‘common’ settings module, with several deployment-specific settings, all under version control. This extends to flat-file configurations too (via the
etcs/directory). -
Clear separation of immutable/mutable aspects of deployment, with a distinction between the site and project directories. No more large VCS ignore files!
-
Compatible with virtually any VCS, and most deployment strategy. Comes with VCS ignore files for Mercurial and Git.
-
Make, enter and activate a virtualenv:
$ virtualenv --no-site-packages mysite New python executable in mysite/bin/python Installing setuptools............done. $ cd mysite/ $ . bin/activate -
Clone this repo into a sub-directory of the new virtualenv:
$ git clone 'git@github.com:carmi/django-skeleton.git' myproject $ cd myproject/ # Remove .empty files, used to make Hg/git track otherwise-empty dirs. $ find . -name '.empty' -exec rm -v {} \; -
Remove the pointer to the GitHub project:
$ git config --unset remote.origin.urlLater you’ll probably want to re-add this configuration with a pointer to your upstream repo. You can do that with the following command (mutatis mutandem):
$ git config remote.origin.url 'git@github.com:USERNAME/PROJECT.git' -
Go through the following files, editing as necessary:
settings/common.pysettings/development.pyurls.pyREQUIREMENTStemplates/base.html
-
Symlink the project directory into the virtualenv’s
site-packages:$ ln -s `pwd` ../lib/python2.6/site-packages/`basename \`pwd\``Replace
python2.6with the installed version of Python on your machine. -
Set the
DJANGO_SETTINGS_MODULEenvironment variable now, and on every virtualenv activation:$ export DJANGO_SETTINGS_MODULE=myproject.settings.development $ echo "!!" >> ../bin/activate -
Install the basic project requirements:
$ easy_install pip $ pip install -r REQUIREMENTSAs you edit your
REQUIREMENTSfile, you can run that last command again;pipwill realise which packages you’ve added and will ignore those already installed.
There is no manage.py file here; use django-boss or
django-admin.py (which will be on your path after you install Django):
$ django-admin.py syncdb
$ django-admin.py runserver
$ django-admin.py test myapp