Skip to content

carmi/django-skeleton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Skeleton

This is a fork of Zachary Voase's django-szkel-project which is based of his blog post “[Django Project Conventions, Revisited][blog post]”.

Features

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

Installation

  1. 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
    
  2. 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 {} \;
    
  3. 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'
    
  4. Go through the following files, editing as necessary:

    • settings/common.py
    • settings/development.py
    • urls.py
    • REQUIREMENTS
    • templates/base.html
  5. 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.

  6. Set the DJANGO_SETTINGS_MODULE environment variable now, and on every virtualenv activation:

    $ export DJANGO_SETTINGS_MODULE=myproject.settings.development
    $ echo "!!" >> ../bin/activate
    
  7. 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.

Managing Your Site

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

About

Django Skeleton - let's kickstart our next django app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%