Skip to content

Instantly share code, notes, and snippets.

@unbracketed
Created November 7, 2009 01:45
Show Gist options
  • Save unbracketed/228457 to your computer and use it in GitHub Desktop.
Save unbracketed/228457 to your computer and use it in GitHub Desktop.
Django virtualenv postactivate hook
#I usually drop something like this into my virtualenv's postactivate for some
#quick and handy shortcuts to common Django commands.
#This way dropping in to do some work on any arbitrary project is as easy as:
# 1. workon <project name>
# 2. djr
cd /path/to/site/root
#Django command shortcuts
alias dj='python manage.py'
alias djr='dj runserver'
alias djrp='dj runserver_plus'
alias djdb='dj dbshell'
alias djs='dj shell'
alias djsp='dj shell_plus'
alias djt='dj test'
alias djm='dj migrate'
alias djsm='dj startmigration'
#A common convention for those who aren't keen on the local_settings approach to Django
#settings overrides often use variations on the play of naming local overrides files
#the same as the machine's hostname. Point Django to the correct one here:
export SERVER_IDENTIFIER=hostname
#For more ideas/inspiration on managing settings across environments see:
#http://github.com/tarequeh/django-config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment