Is Tornado a replacement to Django or are they complementary to each other?

chen picture chen · Jun 6, 2011 · Viewed 28.4k times · Source

I have several questions about Tornado and other web frameworks.

1) Tornado claims to be a webserver (a non-blocking one, therefore much performant), so some people said it does not play the role of django --i.e., they say tornado is not a web framework.

However, it does provide a web framework I think (http://www.tornadoweb.org/documentation#main-modules) -- in this way, it seems to replace django as the web development framework.

Is my above understanding correct?

2) Normally, several Tornados are set up behind Nginx. Tomcat is also normally set up behind Apache web server. Can I say Tornado plays exactly same role of Tomcat does for Java web server? If the answer is yes, then Tornado IS a web framework.

3) I read some article saying using Tornado and Django together, such as http://www.jeremybowers.com/blog/post/3/on-deploying-tornado-web-server-framework/, but I read some article online claiming that "if you use Django, then you lose the asynchronous from Tornado", is this true or false? A related question though, if Tornado is itself a web framework as I said in 1), why people bother using Django at all? (to result the plugin?)

Can someone give me a 101 introduction?

Answer

Peter Bengtsson picture Peter Bengtsson · Jun 8, 2011

To answer the question,

  • NO, Tornado is not a replacement to Django. It's an alternative.

  • YES, they are complementary to each other but not in the same process (*)

I would use Django when it's a big team effort and/or needs to run on a SQL database.

I would use Tornado for everything else. Ie. personal projects, WebSocket related apps, apps that use a NoSQL backend.

(*) don't bother running django inside tornado or the other way around unless you really have a strong requirement for that.