Tuesday, May 31, 2011

Python with virtualenv, fabric

Wow, after a couple of busy months I've finally found a little time to spend on getting some Django love going on. Today, I started off with getting the development environment ready.

Virtualenv:
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/
virtualenv wrapper:
http://www.doughellmann.com/docs/virtualenvwrapper/
make sure django-admin.py runs the local copy of django, not the os-wide:
http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ (tips section)
and setting up a decent postmkvirtualenv
http://blog.doughellmann.com/2010/01/virtualenvwrapper-tips-and-tricks.html
enable tab-completion for pip in bash:
pip completion --bash >> ~/.profile

~/.bashrc gained the following lines:

#set defaults for python development
#from http://www.doughellmann.com/docs/virtualenvwrapper/
export WORKON_HOME=~/python-environments
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
#from www.pip-installer.org/en/latest/
export PIP_RESPECT_VIRTUALENV=true
source /usr/local/bin/virtualenvwrapper.sh



maybe later some more nifty stuff, like automatically enabling a virtualenv when you cd into a directory
http://hmarr.com/2010/jan/19/making-virtualenv-play-nice-with-git/
maybe later for deployment:
http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/