2012-04-26 51 views

回答

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

我已經創建了一個項目,GitHub的https://github.com/cime/bottle-tornadosocket :) – redman 2012-04-26 21:38:14