我的经验已经与Apache(在Linux和Windows上)。你所引用的文章给出了一个ActiveState Python的例子(顺便说一句,这是我在Windows上使用的),适用于运行Python cgi脚本而不是fastcgi。所以如果你想在IIS下运行fastcgi(假设fastcgi是IIS的一个选项),你将不得不在其他地方看看如何做到这一点。
但要回答你的问题:是的,因为IIS确实支持Python cgi脚本,所以你可以在该模式下运行你的Bottle应用程序。例如:
from bottle import Bottle
app = new Bottle()
app.route('/')
def hello():
return 'Hello!'
app.run(server='cgi')
如果你发现配置IIS的FastCGI的的一种方式,那么我建议你安装flup然后代码:
from bottle import Bottle
app = new Bottle()
app.route('/')
def hello():
return 'Hello!'
from flup.server.fcgi import WSGIServer
WSGIServer(app).run()
不管怎么说,上面的两个例子Apache下工作分别用于cgi和fastcgi。我可能会指出,在apache下运行cgi时,我遇到了在Windows上截断输出的问题。无论这是IIS下的问题,你都会发现。见Truncated output using Python bottle 0.12.8 as a CGI application under Windows on an Apache server