Configuring Python on IIS 7

"Features View" -> "Handler Mappings"

Here are the steps how I make Python running in IIS 7. Hope it helps:
1. Please make sure Python is installed properly.
2. Make sure CGI module is installed in IIS 7 
Control Panel -> Programs -> Program and Features -> Turn Windows features on and off -> Internet Information Services -> World Wide Web Services -> Application Development Features -> CGI module.
3. Add web application for Python, In IIS Manager, right click Default Web Site -> Add Application, setting Alias e.g.: PythonApp, and make it pointing to some folder like C:\PythonApp, then click OK
4. In Features View, open Handler Mappings, right click to Add Script Map ...
5. In Request path, put "*.py" as the script files extension, In Executable select "C:\Python25\Python.exe %s %s", here is my Python installation path and its parameters, this is mentioned in the KB article, you can check what are these two parameters used for. Then giving the script mapping an appropriate Name, like Python. Click OK.
6. Create or copy a test.py into the virtual directory (C:\PythonApp), you can find it in the KB article.
7. In Browse View, right click browse to verify it.

Comments