Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
virtualenv postactivate and postdeactivate files for django. Place these files at $VIRTUAL_ENV/bin. That is inside the bin folder inside the virtualenv directory
# This hook is run after this virtualenv is activated.
# Place this file at $VIRTUAL_ENV/bin
# 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
#Django command shortcuts
alias dj='python' # or some other file like
alias djr='dj runserver'
alias djdb='dj dbshell'
alias djs='dj shell'
alias djt='dj test'
alias djm='dj migrate'
alias djsm='dj startmigration'
alias cvt='coverage run --source=. test .'
#For more ideas/inspiration on managing settings across environments see:
# This hook is run after this virtualenv is deactivated.
# unset all aliases to leave things clean after you deactivate
unalias dj
unalias djr
unalias djdb
unalias djs
unalias djt
unalias djm
unalias djsm
unalias cvt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment