在Windows Server 2008 (IIS7)中配置使用 Python 3.0
上一篇 /
下一篇 2012-04-12 15:10:10
1.首先当然是下载Python 了,推荐安装ActivePython这里我用的是3.0版本
安装后才了解Google App Engree目前服务器运行的是2.5版本 -_-|||
这里下载:Windows
x86版本
Windows
x86Linux
x86Linux
x86_64Mac
OS X (Universal)Solaris
8 SPARCSolaris
8 SPARC (64-bit)Solaris
10 x86AIX
PowerPCHP-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 了
收藏
举报
TAG:
python安装