FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

Up and running in server 4




I managed to have a python CGI environment up and running in server 4. The files I now have under public_html are:

The .htaccess has:
Code:
AddHandler mod_python .py
PythonHandler mod_python.cgihandler
PythonDebug On
Options +MultiViews
MultiviewsMatch Handlers

I learned that I must have option MultiViews set and also have to set Handlers in directive MultiviewsMatch.

The environment.py has:
Code:
#!/usr/bin/env python

import os
import sys

env = ""
keys = os.environ.keys()
keys.sort()
for k in keys:
    env = env + "%s = %s</br>" % (k, os.environ[k])

print """Content-type: text/html; charset=iso-8859-1

<html>
<head>
<title>Environment</title>
<body>
Environment
<hr>
%s
<hr>
Python: %s
</body>
</html>""" % (env, sys.version)

With this setup I can request http://.../ptest/environment without the file extension, which is nice and clean.



0 blog comments below




FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.