在IIS7或以上版本配置Python

本文详细介绍了在Windows环境下使用IIS7配置Python Web应用的方法,包括确保Python和CGI模块正确安装,创建Python应用,设置处理映射等步骤,并提供了测试验证过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值