首页 运维 网络学院 查看内容

Windows Server 2008 (IIS7)中配置使用 Python 3.0

2011-5-9 11:14 766 0

摘要:   1.首先当然是下载Python 了,推荐安装 ActivePython 这里我用的是3.0版本  安装后才了解Google App Engree目前服务器运行的是2.5版本  这里下载: Wind...
关键词: Python print Solaris 版本 ActivePython 网站 IIS x86 Windows 站点

  1.首先当然是下载Python 了,推荐安装 ActivePython 这里我用的是3.0版本  安装后才了解Google App Engree目前服务器运行的是2.5版本  这里下载: Windows x86 版本  Windows x86  Linux x86  Linux x86_64  Mac OS X (Universal)  Solaris 8 SPARC  Solaris 8 SPARC (64-bit)  Solaris 10 x86  AIX PowerPC  HP-UX PA-RISC  2.安装 ActivePython 就不用说了。一路Next >>  3.IIS7 的控制管理器   ,在站点的ISAPI and CGI 限制 中配置 C:\Python30\Python.exe %s %s  4.在站点的 处理程序映射 中添加"*.py"到 C:\Python30\Python.exe %s %s 的映射  5.添加IIS 中的默认文档  6.打开你在IIS中添加网站的目录,找到 web.config  修改为如下内容:  <?xml version="1.0" encoding="UTF-8"?>  <configuration>  <system.webServer>  <handlers>  <add name="ActiveState3.0" path="*.py" verb="*" modules="CgiModule"  scriptProcessor="C:\Python30\Python.exe %s %s" resourceType="Unspecified" />  </handlers>  </system.webServer>  </configuration>  7. 测试Python 是否可以正常工作了  1)重新启动 IIS  2) 编写一个测试 index.py 文档 ,放在网站目录下,内容如下:(为 Python3.0+ 代码,不向下兼容)  print ('Status: 200 OK')  print ('Content-Type: text/html')  print ('')  print ('<html><head><title>Hello Xeye</title></head>')  print ('<body>')  print ('<h1>Hello, Xeye!</h1>')  print ('</body>')  print ('</html>')  3)打开浏览器。访问添加的网站,如果能看到如下的画面,恭喜,你的IIS7已经可以支持 Python 了
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部