redman
redman

Reputation: 2165

Tornado - mount Bottle app

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

Upvotes: 0

Views: 1286

Answers (1)

defnull
defnull

Reputation: 4199

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

Upvotes: 2

Related Questions