Skip to content

Instantly share code, notes, and snippets.

Embed
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
#!/bin/bash
# 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 manage.py' # or some other file like manage_custom.py
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=. manage_freebase.py test .'
#For more ideas/inspiration on managing settings across environments see:
#http://github.com/tarequeh/django-config
#!/bin/bash
# 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
You can’t perform that action at this time.