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 '[email protected]: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.url
Later 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 '[email protected]:USERNAME/PROJECT.git'
-
Go through the following files, editing as necessary:
settings/common.py
settings/development.py
urls.py
REQUIREMENTS
templates/base.html
-
Symlink the project directory into the virtualenv’s
site-packages
:$ ln -s `pwd` ../lib/python2.6/site-packages/`basename \`pwd\``
Replace
python2.6
with the installed version of Python on your machine. -
Set the
DJANGO_SETTINGS_MODULE
environment 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 REQUIREMENTS
As you edit your
REQUIREMENTS
file, you can run that last command again;pip
will 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