1. Please make sure Python is installed properly.
请确保Python已经正确安装
2. Make sure CGI module is installed in IIS 7
确保IIS7开启了CGI
Control Panel -> Programs -> Program and Features -> Turn Windows features on and off -> Internet Information Services -> World Wide Web Services -> Application Development Features -> CGI module.
控制面板--程序--程序和功能--打开关闭系统功能--IIS--WWW服务--应用程序开发功能--CGI
(我用英文系统,不一定翻译恰当)
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
为Python添加一个web应用程序。这一步就是在IIS创建一个网站,指定到你的Python应用程序目录。
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.
在弹出的窗口中,”请求路径“填写"*.py"作为Python的扩展名。在”可执行"填写你的Python安装目录,最后以"Python.exe %s %s"结尾。"名称“任意填,如”Python“。最后点击确定。
6. Create or copy a test.py into the virtual directory (C:\PythonApp), you can find it in the KB article.
在你的Python应用程序目录下创建测试文件。
7. In Browse View, right click browse to verify it.
在IIS中打开浏览视图并右击文件进行验证。
原文:http://forums.iis.net/t/1122937.aspx