Setting up Dreamhost with Python, Django, Tastypie, South, etc
- Install VirtualEnv and PIP
$ curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
$ python virtualenv.py my_env
$. my_env/bin/activate
you should see your prompt slightly change now, indicating that you are within your new (my_env), you may start installing new packages into this new environment. More about pip here.
I installed my_env in my home directory /home/<username>
and the site packages under my_env will be installed in:
/home/<username>/my_env/lib/python2.5/site-packages
if you use a different directory, just adjust in the passenger_wsgi.py file - Install Yolk
$ pip install yolk
This is basically just so that you can do “yolk -l” to list all the python packages installed in your environment. More about yolk here. - Configure passenger_wsgi.py to use activate virtualenv
edit passenger_wsgi.py in your app root directory (domain.com)import os, sys, site
....
site.addsitedir('home/<username>/my_env/lib/python2.5/site-packages')
activate_this = os.path.expanduser('~/my_env/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
....
These are only the necessary lines, please merge with your passenger_wsgi.py accordingly. - Install TastyPie, don’tforget to run syncdb!
$ pip install django-tastypie
- Install South
$ pip install South
- Install *
Means you can now install whatever you want into this new environment
you can even install your own django version! - To quit my_env just:
$ deactivate