Django bash alias

Rambling on about Django 91 months ago.

Here's a small little alias which I use every day in my Django development (put them at the end of your ~/.bashrc or somewhere else that'll work):

alias dj='python'
alias djr='dj runserver'

Now, whenever you need to start your development server, you only have to type djr. To do a different management task such as a syncdb, you'd just type dj syncdb. It's all pretty obvious, but sometimes it's the little things which make life easier :)

Leave a comment or see my other ramblings.

Comments (5)

Amit Upadhyay said: (91 months ago)

You should mention that django comes with bash completion support for django's and!

:) Chris said: (91 months ago)

Yea, but I've never found typing the command the difficult bit. ;)
Good additional point though.

David, biologeek said: (91 months ago)

Clever, I hadn't thought about that but it will make my life easier, thanks.

William McVey said: (89 months ago)

I do most of my django app development outside of site's startproject directory hierarchy. I've found that it's actually quite nice to be able to execute '' in whatever directory I happen to be in at the time using python's -m option. For example:

python -m manage syncdb

This depends on my PYTHONPATH being set up correctly, but really liberates me from being constrained to a particular "project directory".

owen said: (88 months ago)

how isntruct syncdb inner the file example:

from django.db import models
from juan import manage syncdb

class Editorial(models.Model):
nombre = models.CharField(maxlength=30)
Res at my email:

Leave a comment