Virtualenvwrapper with example postactivate script

Install virtualenvwrapper:

$ pip install virtualenvwrapper

Configure virtualenvwrapper so you can use "workon project":

$ cd
$ vim ./bashrc

Add the following code on the end of your startup script:

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh # for Ubuntu
source /usr/bin/virtualenvwrapper.sh  # for Debian, CentOS (choose one of these lines)

Create a virtualenv:

$ mkvirtualenv example

Activate the virtualenv:

$ workon example

Edit the postactivate script if you want to cd to your project dir and add a handy alias to run the Django server:

$ workon example
$ (example) cdvirtualenv
$ (example) vim bin/postactivate
#!/bin/zsh
# This hook is run after this virtualenv is activated.
cd /path/to/project
alias rs="python /path/to/project/manage.py runserver 0:8000"
alias cov="coverage run --source /path/to/project/src -m pytest && coverage html"

Remove a virtualenv:

$ rmvirtualenv example