0

How do you mount Bottle app in Tornado server? Here is my code

redman
  • 2,115
  • 5
  • 32
  • 59

1 Answers1

2

bottle.default_app() returns a WSGI callable:

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()
defnull
  • 4,169
  • 3
  • 24
  • 23
  • 1
    I already created a project on the github https://github.com/cime/bottle-tornadosocket :) – redman Apr 26 '12 at 21:38