python - How to run Flask app with Tornado -
i run simple app written in flask tornado. how do this? want use python 2.7 , latest tornado version (4.2).
from flask import flask app = flask(__name__) @app.route('/') def hello(): return 'hello world!' if __name__ == '__main__': app.run()
the flask docs used describe how this, has been removed due performance notes below. don't need tornado serve flask app, unless async code written in tornado.
from tornado.wsgi import wsgicontainer tornado.httpserver import httpserver tornado.ioloop import ioloop yourapplication import app http_server = httpserver(wsgicontainer(app)) http_server.listen(5000) ioloop.instance().start()
the tornado docs wsgi describe well. include big warning less performant using dedicated wsgi app server such uwsgi or gunicorn.
Comments
Post a Comment