Recognising that the post asks about mod_python, I'm posting the following, in case using CGI is acceptable.
It has been a while since I got this to work, but I got CGI scripts written with Python to run under Wampserver with a couple simple things (although it didn't seem simple at the time):
- Download and install Python if you haven't already. The standard install should let you run programs from a command prompt (which you'll need).
- Write your Python CGI program, making the first line be
#!python
(or the full path to the python executable). While the first line isn't usually necessary for Python programs under Windows, Apache seems to need this so it knows the program is Python.
- Place the program in your cgi-bin directory.
That should do it. I double checked my httpd.conf file and don't see any changes to get Python working. (This assumes you already have CGI working otherwise.)
The following simple script should tell you if you have things working:
#!python
print "Content-type: text/html"
print ""
print "<html>"
print "<head>"
print "<title>CGI Test of Python</title>"
print "</head>"
print "<body>"
print "This is a test"
print "</body>"
print "</html>"