Running Python Scripts on Windows with Apache and Xampp

You can run Apache on Windows via an easy to use tool called Xampp. If you are having trouble with IIS, or if you just prefer running Apache, even on Windows, then you should try Xampp. It installs quickly, and has little apparent impact on your Windows installation.

xampp is a forehead install, so I will not talk you through that. For our purposes, of course you want the Windows version. Next  you want to install Python, which is another forehead install. I assume you have installed both xampp and python on the C Drive:

You should not have to do anything to get CGI working on your server, but you do need to set up Python itself:

If you want a complete example, you can create a script like the following, and put it in c:\xampp\cgi-bin:


print "Content-type: text/html"
print "<html>"
print "<head>"
print "<title>Elvenware CGI</title>"
print "</head>"
print "<body>"
print "<h1>Basho!</h1>"
print "<p>By a Peaceful dark pond</p>"
print "<p>A frog plops</p>"
print "<p>Into the still water</p>"
print "</body>"
print "</html>"

Notes: I'm not at all sure it is mandatory, but I put Python on my path. You do not need or want to install mod_python, but wsgi might be useful. We will address that issue later. 

Here is some useful information from the Apache site.

IIS Issues