为什么要一起使用龙卷风和烧瓶? [英] Why use Tornado and Flask together?
问题描述
如果使用 Tornado作为WSGI服务器并使用Flask进行网址路由+模板,不应该有任何开销。使用这种方法,您不使用Flask的Web服务器,所以实际上并没有额外的抽象层。
但是,如果使用Flask仅仅用于模板他们可以通过 Jinja2 来使用Tornado,这是Flask使用的模板引擎。
As far as I can tell Tornado is a server and a framework in one. It seems to me that using Flask and Tornado together is like adding another abstraction layer (more overhead). Why do people use Flask and Tornado together, what are the advantages?
According to this question it is because Flask is blocking and Tornado is non-blocking.
If one uses Tornado as a WSGI server and Flask for url routing + templates there shouldn't be any overhead. With this approach you aren't using Flask's web server, so there isn't really an extra layer of abstraction.
However, if one is using Flask just for the templates they could use Tornado with Jinja2 which is the template engine that Flask uses.
这篇关于为什么要一起使用龙卷风和烧瓶?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!