3

We have a project use Flask+Gunicorn(sync). This works well for a long time, however, recently i came across to know that Asyncio(Python3.5) support async io in standard library.

However, before Asyncio, there are both Twisted and Tornado async servers. So, i wander whether Flask can use the aysncio feature of Tornado, cause Gunicorn support tornado worker class.

andy
  • 3,951
  • 9
  • 29
  • 40
  • You can use the WSGIContainer object: http://flask.pocoo.org/docs/0.10/deploying/wsgi-standalone/ – Martijn Pieters Oct 27 '15 at 12:59
  • @MartijnPieters Yes, i know that. What makes me curious is that whether we can still use Flask+Tornado to work around C10K. – andy Oct 29 '15 at 03:44

1 Answers1

4

No. It is possible to run Flask on Tornado's WSGIContainer, but since Flask is limited by the WSGI interface it will be unable to take advantage of Tornado's asynchronous features. gunicorn or uwsgi is generally a much better choice than Tornado's WSGIContainer unless you have a specific need to run a Flask application in the same process as native Tornado RequestHandlers.

Ben Darnell
  • 21,844
  • 3
  • 29
  • 50