怎样在IIS中写Python的CGI脚本
2005-01-25 17:16
387 查看
1。安装好Python;
2。配置IIS:
a.打开管理工具-〉Internet信息服务;
b.在网站属性上右键,进入属性设置;
c.转到主目录页,进入应用程序配置;
d.添加一个映射:可执行文件写:C:/Python23/Python.exe ”%s” %s
注意Pythong的路径要指向你安装Python的位置,同时注意参数间的空格。
扩展名写:.py
动作限制为:GET,HEAD,POST
e.选中脚本引擎,选中检查文件是否存在;
f.一路确定完成配置。
3。编写CGI脚本:
import cgi #倒入cgi模块 print 'Content-Type: text/html' #必须,输出HTML文档头 print # Blank line marking end of HTTP headers #必须,文档头必须以空行结束 cgiParameters = cgi.FieldStorage() #取得Post或Get过来的参数集 # 检查看是否是我们需要的参数 if not (cgiParameters.has_key("name") and cgiParameters.has_key("address")):#如果不是输出form,要求填写name和address print "<form action='' method='post' name='form'><input name='name' id='name'><input name='address' id='address'><input type='submit' value='submit'></form>" print "Please fill in the name and address fields." else: #如果是我们要求的参数,输出参数内容 print "<p>name:", cgiParameters["name"].value print "<p>address:", cgiParameters["address"].value |
相关文章推荐
- 转:怎样在IIS中写Python的CGI脚本
- 在IIS服务器上以CGI方式运行Python脚本的教程
- IIS上执行通过python的CGI模块执行python脚本
- IIS下配置运行python脚本的CGI
- 配置Apache2.x 支持shell脚本和Python编写CGI程序+测试程序
- Python使用CGIHTTPServer调用shell作为cgi脚本
- 让你的IIS执行Python脚本,并推荐一个Python的MVC框架
- 如何创建和使用Python CGI脚本
- IIS7以CGI方式运行Python脚本
- Apache-tomcat-6.0.36配置基于Python的CGI脚本解析
- Python ----脚本CGI、特点、应用、开发环境
- 【脚本语言系列】关于Python网页服务Microsoft IIS,你需要知道的事
- Python+CGI,在Windows上快速部署Python到IIS
- Running Python CGI Scripts on IIS(Windows操作系统,在IIS上运行Python)
- window下如何配置apache Http服务器使其能运行python cgi脚本
- apache-tomcat-6.0.36配置基于Python的CGI脚本解析
- 怎样在IIS下配置PHP,isapi模式php,解决php-cgi.exe占用CPU过多,甚至100%
- IIS 使用 Python 脚本
- Apache Web 服务器配置CGI程序,执行Python、Perl脚本
- Win7下IIS中配置Python脚本运行环境