Web2py
From DreamHost
Web2py is a Python web framework. It seems very user-friendly and has a feature I haven't seen on similar ones: in-page code editing. This means you can manage your entire application via web.
Unfortunately it has limited installation instructions, at least for shared-hosting environments. Thus the creation of this page.
Necessary steps:
- Install Python 2.5 by following this wiki page
- Install setuptools
- Run easy_install Flup
- Download and extract web2py
- Run python web2py.py to create the necessary framework files
- Create a file dispatch.fcgi at the root of web2py directory with the following content:
#!/home/youruserhere/run/bin/python import sys from flup.server.fcgi_fork import WSGIServer import gluon.main application=gluon.main.wsgibase ## or # application=gluon.main.wsgibase_with_logging WSGIServer(application).run()
- make this file executable by typing chmod +x dispatch.fcgi
- create or add the following lines to .htaccess:
RewriteEngine On RewriteBase / RewriteRule ^dispatch\.fcgi/ - [L] RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
Now try and access the sub/domain on your browser and it should work!
Addendum
You will note that you will not be able to access the admin page unless you're using SSL. This is however easy to circumvent by editing /applications/admin/models/access.py
Also, for the database administration to work you will have to edit /applications/your_app_name/controllers/appadmin.py (you'll have to do this for every app).
comment lines:
elif remote_addr not in hosts:
raise HTTP(200, T('appadmin is disabled because insecure channel'))
and duplicate parameters_8000.py as parameters_80.py. But note that this is not recomended!!!
python 2.6
I installed python 2.6.1 and although it complained during the make stage it is working fine and actually seems faster than 2.5.2. The modules it wasn't able to build were:
_bsddb _tkinter bsddb185 bz2 dbm readline sunaudiodev
Ease way using WSGI Here are the steps I took to get web2py working with wsgi:
- I installed my own python distro so I could use 2.6. I don't know if this is neccessary.
- Created a subdomain like: web2py.mydomain.com. When creating the new domain, make sure to check enable "Ruby on Rails Passenger" or mod_rails.
- I svn checkedout a fresh web2py right into my domain's root (/home/username/web2py.mydomain.com). Note, this isn't the public directory. The previous step requires you to set a subdirectory as the public directory.
- I created a symlink as follows: ln -s wsgihandler.py passenger_wsgi.py. This is neccessary because the rails stuff looks for this file.
- And last, but not least, so that wsgihandler uses my 2.6 version of python, I added the following to wsgihandler.py near to the top:
import sys import os INTERP = "/home/username/opt/bin/python" if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
For more info on this subject, see Passenger_WSGI
If anyone is aware of a paid-for-hosting service that supports web2py, please edit this page. This approach would save much admin hassles for many.

