I’m reformatting these pages, and this one might not look right.

$ django

By Chad Whitacre
May 28, 2009

For one reason and another, I am trying to work more and more with stock Django, rather than wrangling Django into Aspen. One specific way this plays out is that I want to "sit" inside of a Django project directory while developing. I want to treat the Django project as top-level, not bury it inside of a lib/python directory. That way, I am close to settings.py, manage.py, etc.

However, to my eye, this is ugly:

$ python manage.py foo

If I make manage.py executable, then I get this:

$ ./manage.py foo

Aesthetically, I think that's worse. What I really want is:

$ django foo

Well that's easy enough. I just copied manage.py to ~/bin and tweaked it a little bit. Now I can call django on any directory that has a settings.py in it. The amount of Django API that this script uses is limited enough that it should work across multiple versions, so I can have a globally-installed django executable and (via, e.g., virtualenv) use local versions of the django libraries as needed per-project. Huzzah!

Now, if only Django would stop trying to treat my projects as Python modules ...