日期:2014-05-16  浏览次数:21477 次

IIS支持Python的方法
环境IIS6 + Python2.6,其他版本都差不多。

新建Web服务扩展,py,要求的文件填写:
D:\Python26\python.exe %s %s

网站>属性>主目录配置>映射>添加:
扩展名:.py
可执行文件填写:"D:\Python26\python.exe" %s %s

print ('Status: 200 OK')
print ('Content-Type: text/html')
print ('')
print ('<h1>Hello, Python</h1>')

需要注意,测试文件里最好不要有多余的空格和字符,否则有可能会报The specified CGI application misbehaved by not returning a complete set of HTTP headers
这样的错误。