【问题标题】:Tornado - mount Bottle appTornado - 安装瓶应用程序
【发布时间】:2012-05-06 23:08:35
【问题描述】:

如何在 Tornado 服务器中挂载 Bottle 应用程序? Here is my code

【问题讨论】:

    标签: python websocket wsgi tornado bottle


    【解决方案1】:

    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()
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多