If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

From your home folder, install virtualenv. This will allow us to add modules to Python by creating a virtual environment in our home folder:

wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.4.5.tar.gz
tar xzf virtualenv-1.4.5.tar.gz
python2.5 virtualenv-1.4.5/virtualenv.py $HOME/local

Add your new ~/local/bin folder to the beginning of your PATH so it takes priority:

PATH="$HOME/local/bin:$PATH"    
export PATH

Now add the two lines above to your .bash_profile so this will be set automatically when you login:

nano .bash_profile

After adding the lines, save the file by hitting Ctl-x, y, ENTER

Install the MySQL module if you need it:

easy_install MySQL-python

Download the source release, unzip it and move the contents directly into your domain's root folder (yourdomain.com).

cd
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
mv web2py/* yourdomain.com/

Change your root web directory to yourdomain.com/public at panel.dreamhost.com and enable Passenger on your Dreamhost account:

alt text

Edit wsgihandler.py and add these two lines near the top after 'import os' to redirect requests to virtualenv's python2.5:

...
import os
INTERP = "/home/username/local/bin/python2.5"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
...

Symlink wsgihandler.py to passenger_wsgi.py with the following command:

ln -s wsgihandler.py passenger_wsgi.py

That's it! A word of warning though...this seems to break the Dreamhost stats and myPHPadmin.

To restart your app, create or modify the file tmp/restart.txt in domain's root folder.


Links:

Dreamhost WIKI

Phusion Passenger

Related slices

Comments (2)


Hosting graciously provided by:
Python Anywhere