Python IIS 7.5 上的 Bottle 和 CGI​​(或 fastCGI)可以用于生产吗?

Can Python Bottle and CGI (or fastCGI) on IIS 7.5 be used for Production?

我正在使用 Bottle,运行从内置服务器的命令提示符中使用它。当我部署它时,我在文档中没有看到 IIS:

http://bottlepy.org/docs/dev/deployment.html

据我所知,它并不是真正为 IIS 制作的,但微软有一篇文章:

https://support.microsoft.com/kb/276494?wa=wsignin1.0

考虑到所有这些,Bottle 能否在 IIS 7.5 上 运行 - 用于 Production

我在 SO 和其他地方看到了一些关于 fastCGI 和 Python 的问题,但我不知道这是否适用于生产。

请注意,我不想使用 IronPython。除了 Python 解释器,我还想尽可能多地使用 MS IIS(我必须这样做)。

我的经验是使用 Apache(在 Linux 和 Windows 上)。您引用的文章给出了 ActiveState Python 的示例(顺便说一句,这是我在 Windows 上使用的)并且适用于 运行ning Python cgi 脚本而不是 fastcgi。所以如果你想 运行 在 IIS 下使用 fastcgi(假设 fastcgi 是 IIS 的一个选项),你将不得不去别处看看如何做到这一点。

但要回答您的问题:是的,因为 IIS 确实支持 Python cgi 脚本,您肯定可以 运行 您的 Bottle 应用程序在该模式下。例如:

from bottle import Bottle
app = Bottle()

app.route('/')
def hello():
   return 'Hello!'

app.run(server='cgi')

如果您找到了为 fastcgi 配置 IIS 的方法,那么我建议您安装 flup 然后代码:

from bottle import Bottle
app = Bottle()

app.route('/')
def hello():
   return 'Hello!'

from flup.server.fcgi import WSGIServer
WSGIServer(app).run()

不管怎样,上面的两个例子分别在Apache for cgi 和fastcgi 下工作。我可能会指出,当在 apache 下 运行ning cgi 时,我的输出被 t运行cated on Windows 时遇到了问题。在 IIS 下这是否会成为问题,您会发现。参见