David Ziegler's personal blog of computing, math, and other heroic achievements.


30 Sep 2009

A replacement for django-admin.py startproject

When I create new Django projects, I find myself doing a lot of the same things over and over. For instance, the file structure of each project is pretty much identical, and looks something like this:

  • deploy
    • wsgi_handler.py
  • docs
  • env (my virtualenv folder)
  • src
    • apps
      • profiles
      • photos
      • etc.
    • localsettings.py
    • manage.py
    • scripts
    • settings.py
    • static
      • css
      • images
      • js
    • templates
    • urls.py

The things is, I’m lazy, and it’s tedious to create all those directories, create my wsgi_handler, uncomment the admin app, update my settings.py, urls.py, etc for every project I create. I basically end up copying/pasting/deleting from old projects.

So to automate some of that, I made a small reusable django app to serve as a replacement for django-admin.py startproject. So instead of

 django-admin.py startproject project_name

you would do

 create_project project_name

To install, either clone the git repository which you can find here:

http://github.com/dziegler/django-create-project

or install with pip using:

pip install -e git+git://github.com/dziegler/django-create-project.git#egg=django-create-project

I made this mainly for my benefit, so some of the settings are tuned to my preferences. For example, it changes TIME_ZONE in in settings.py from ‘America/Chicago’ to ‘America/Los_Angeles’, and automatically installs django_extensions, debug_toolbar, and django-css because I use those in all of my projects. Since it’s on github, it’s fairly easy to fork and customize to fit your preferences. You can find it here:

http://github.com/dziegler/django-create-project

Comments (View)

blog comments powered by Disqus
Page 1 of 1