0

你如何在 Tornado 服务器中安装 Bottle 应用程序? 这是我的代码

4

1 回答 1

2

bottle.default_app()返回一个 WSGI 可调用对象:

if __name__ == "__main__":
    bottle_app = bottle.default_app()
    bottle_handler = tornado.wsgi.WSGIContainer(bottle_app)
    HTTPServer(Application([(r"/ws", WSHandler),
                            (r"/css/(.*)", StaticFileHandler, {"path": "./css/"}),
                            (r"/js/(.*)", StaticFileHandler, {"path": "./js/"}),
                            (r"/img/(.*)", StaticFileHandler, {"path": "./img/"}),
                            ("/(.*)", bottle_handler)])
                         ).listen(1024)
    IOLoop.instance().start()
于 2012-04-26T20:02:08.570 回答