Wednesday, April 21, 2010

python cgi with xxamp/apache on windows

I recently figured out that a web service class I was dealing with (WFS in OpenLayers) would only accept requests through a proxy script (despite the requests were sent to my local machine!). OpenLayers has a .cgi proxy script which runs through Python, and here's how I got it to work:

1. Download proxy.cgi to the cgi-bin folder within xampp (or wherever it is), and install Python. I used version 2.5
2. Follow these instructions to setup Apache for running python
3. Finally, make sure you change the "shebang" line at the top of proxy.cgi from #!/usr/bin/env python to #!c:/python25/python (if python.exe is installed at C:\Python25\python.exe)