Skip to content

Instantly share code, notes, and snippets.

@manuganji
Forked from unbracketed/gist:228457
Last active June 27, 2018 10:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save manuganji/9069466 to your computer and use it in GitHub Desktop.
Save manuganji/9069466 to your computer and use it in GitHub Desktop.
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