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:
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:
Comments (3)
0
jtk 8 years ago
Does Dreamhost require you to use a VPS to make this work? This posting says so, but I don't see why. I'm able to get Flask running using similar code in passenger_wsgi.py, but with web2py, Passenger times out, saying it didn't get a response from the web application in time.
replies (1)
0
babu 14 years ago
0
mrfreeze 14 years ago