I have been trying for the past few hours to get python working on a test machine. The machine is running Server 2008 SP2 with IIS7 (32 bit). I have nearly all the role's services installed except for ASP.Net , .Net extensibility and ASP . I have installed python2.6 and download the correct version of pyISAPIie . I have followed to the word the following instructions i found :
Installation on IIS 7
First make sure IIS is actually installed (Server Manager >> Roles >> Add Web Server IIS). Ensure the ISAPI Extensions and ISAPI filters are both checked.
Download the latest PyISAPIe extension. Make sure you get the correct version for your version of Python. In this example I am using Python 2.5.4 and PyISAPIe 1.1.0-rc4-Py2.5
Where to put the files took a while to resolve..in the end it becomes apparent they can be placed anywhere! I got confused by my understanding of packages and by thinking I could test the Python scripts outside of a browser / IIS.
In the end I created a new folder in C:\Python25 named PyISAPIe. I then copied into this the pyISAPIe.dll and HTTP folder.
Next you’ll need to set up the handler in IIS. I wanted all files that ended with the .py extension to be handled by the PyISAPIe DLL, so I did the following:
under sites add a new application (I used the name /apps) select the site, and then select “Handler Mappings” right-click and select “Add Script Map” set the “Request path” to *.py set the “Executable” to “C:\Python25\PyISAPIe\PyISAPIe.dll give the handler a relevant name such as “PyISAPIe” in the Request Restrictions section, I set my handler to run only when a request contains a .py file that exists on the server. I set it handle all verbs (GET and POST), and gave it Script access. select the “View Ordered List” in the Actions panel to see in what order handlers will be applied to a request. Make sure your .py handler has a higher priority than the default StaticFile handler, or it won’t get a chance to handle anything. The StaticFile handler may also appear to be handling requests if your custom handler fails as by default PyISAPIe moves to the next handler on an error.
Then it says to create the following test script : ( test.py ) from Http import * def Request(): Header("Content-type: text/html") Write("Hello, World!")
When i browse to "http://localhost/test.py" i get the following errors : HTTP Error 500.0 - Internal Server Error
There is a problem with the resource you are looking for, so it cannot be displayed.
Detailed Error Information
Module : IsapiModule Notification :ExecuteRequestHandler Handler : Python Error Code : 0x8007007e Requested URL :http://localhost:80/test.py Physical Path : C:\inetpub\test\test.py Logon Method : Anonymous Logon User :Anonymous
Anyone have any ideas on how to fix this?