Web.py mod_python Setup Information
Web.py is a web framework for python that is as simple as it is powerful.
Setup
Web.py is supported with our CGI package and Python package.
mod_python handler
A ".htaccess" file needs to be created to run the Web.py application
handler. The contents of the file is similar to the following:
<Files *.py>
PythonPath "sys.path + ['/home/[yourusername]/htdocs']"
AddHandler python-program .py
PythonHandler wsgiref.modpython_gateway::handler
PythonOption wsgi.application [yourappname]::main
PythonDebug On
</Files>
Please replace "[yourusername]" and "[yourappname]" with the your actual
account username and application filename without the ".py" extension. you will need to upload this file in UNIX format not Windows.
Example application
Here is an example "script" that you can use to test your setup,
import web
urls = ('/', 'index')
class index:
def GET(self):
print "Hello, world!"
web.webapi.internalerror = web.debugerror
main = web.wsgifunc(web.webpyfunc(urls, globals()))
Accessing your pages from the web
To access your page from a web browser or from a link in another page, you need to use a URL in the formats below, notice
the ending slash.
- http://www.jbloggs.devisland.net/app.py/
Or just like this for a relative link:
|