Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

django

tornado

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?

like image 551
chen Avatar asked Jun 06 '11 04:06

chen


People also ask

Is tornado asynchronous?

Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.

What is Tornado Python used for?

Tornado is a Python web framework and an asynchronous networking library that relies on non-blocking network I/O to serve web applications. It is the preferred choice for any project that requires a long-lived connection to each user.

Why is Django better than other frameworks?

Django is the best framework for web applications, as it allows developers to use modules for faster development. As a developer, you can make use of these modules to create apps, websites from an existing source. It speeds up the development process greatly, as you do not have to code everything from scratch.

What framework is Django based on?

Django is a framework that was built with Python code. It's a tool that adds functionality and expedites the process of coding with Python. Django contains Python code that has already been written to provide functionality that is ready to be plugged into a project.


1 Answers

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, or 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.

like image 144
Peter Bengtsson Avatar answered Sep 17 '22 13:09

Peter Bengtsson