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/ # for Ubuntu
source /usr/bin/  # 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
# This hook is run after this virtualenv is activated.
cd /path/to/project
alias rs="python /path/to/project/ runserver 0:8000"
alias cov="coverage run --source /path/to/project/src -m pytest && coverage html"

Remove a virtualenv:

$ rmvirtualenv example