I made a web app with flask and ran it with flask's own web server with parameter 'threaded=True'. It worked perfectly.
app.run(host='0.0.0.0', port=5000, threaded=True)
But sooner I've found that it's only suitable for dev environment, so I decided to use 'tornado'. But it doesn't work concurrently.
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
IOLoop.instance().start()
Is there any parameter like 'threaded=True' of flask to thread? Or should I do it manually? If so, what is the proper way to do it?
Tornado's WSGIContainer does not support threads, which means that it is also not suitable for most production usage (the rest of Tornado is, just not WSGIContainer). It's only a good idea to use Tornado's WSGIContainer when it's important to serve both Tornado RequestHandlers and WSGI applications in the same process. Otherwise, I recommend gunicorn
or uwsgi
.