Compare Django and Tornado

Django is Python web framework that encourages rapid development. It is based model-template-view (MTV) design pattern. It follows a "batteries included" philosophy and ships with many tools that are needed by application developers such as ORM framework, admin panel, directory structure and more.

Tornado is a Python web framework and asynchronous networking library developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user. It is great for use cases that are I/O intensive (e.g., proxies) but not ideal for compute-intensive use cases.

Let's see how Django and Tornado compare on various factors and features and which to choose when.

Django

Tornado

Overall

Type

Type
Python all-inclusive, megaframework for building web application.
Type
Python web framework and asynchronous networking library, which does non-blocking I/O.

Author

Author
Adrian Holovaty - Author of Django
Adrian Holovaty and Simon Willison.
Author

Release Date

Release Date
2005
Release Date
2009

License

License

Website

Adoption and Ease of Use

Popularity [?]

Popularity [?]
5 Stars
Used by 367,000 projects.
Popularity [?]
1 Star
Used by 84,000 projects.

Used by

Used by
Instagram, Pinterest, Coursera, Udemy.
Used by
FriendFeed, Turntable.fm, Fantamaster.it

Jobs [?]

Jobs [?]
4.5 Stars
2074 job openings which list Django as a requirement.
Jobs [?]
0.5 Star
20 job openings which list Tornado as a requirement.

Performance [?]

Performance [?]
4.5 Stars
Not as fast as compared to bare-bones Flask or other microframeworks, but for many real-world use cases, the difference is negligible.
Performance [?]
5 Stars
Excellent performance.

Flexibility

Flexibility
4.5 Stars
Django expects things to be done in a certain way unlike microframeworks (e.g. Flask) which have no opinion on how developers structure things. However, It does this without compromising on flexibility. Django has been used to build a variety of things from content management systems to social networks to scientific computing platforms.
Flexibility
5 Stars
Tornado is simple and flexible.

Ease of Learning

Ease of Learning
5 Stars
Has a learning curve especially for those who are not familiar with other web frameworks. But there are some great online resources, courses tutorials and YouTube videos.
Ease of Learning
4 Stars
Tornado is not difficult to learn if the user is familiar with asynchronous and non-blocking I/O. The online resources, courses, and tutorials are not as plentiful compared to Flask or Django.
Database Support

RDBMS Support

RDBMS Support
Built-in Support
Built-in
Django ships with a built-in ORM framework for developers to start using out of the box.
Verdict ORM is one of the best features of Django, loved by developers.
RDBMS Support
Through Plugins or Extensions
Through Plugins or Extensions
Being an asynchronous framework, Tornado doesn't play well with ORM frameworks. See this stackoverflow answer for more details. It doesn't come with a built-in ORM framework, but 3rd party libraries that can be used. Such as tornado-sqlalchemy, Tornado-MySQL (experimental), etc.

NoSQL Support

NoSQL Support
NoSQL databases are not officially supported by Django. There are open source projects like PynamoDB or Django MongoDB Engine, Django non-rel to support NoSQL. Some of these extensions support specific Django versions and don't interplay well with Django ORM.
Verdict Using NoSQL database with Django is not recommended.
NoSQL Support
No built-in support for NoSQL databases, but 3rd party libraries support asynchronous, non-blocking access. Motor is one such library from the makers of MongoDB. However, a lot of client libraries like DynamoDB appear to have been deprecated or not actively maintained.
Web & Core Features

Admin Dashboard

Admin Dashboard
Built-in Support
Built-in
Django ships with a web-based admin site that has a friendly UI. It allows you to quickly perform CRUD operations against your models from your browser to test things out.
Admin Dashboard
No or Limited Support
No or Limited Support
No built-in admin panel. No well-known 3rd party tools either.

REST Support

REST Support
While not built-in, REST development is supported via the popular and active Django REST Framework project. It provides support for API versioning, Browsable API for interacting with APIs through web browser, authentication (OAuth1 and OAuth2) and serialization support for both ORM and non-ORM sources.
REST Support
No built-in support for REST API, but users can implement REST APIs manually.

Security

Security
Built-in protection against several common attack vectors like CSRF, XSS, and SQL injection. When vulnerabilities are discovered, the Django team has an excellent security policy and fixes are released quickly.
Security
Built-in security mechanisms such as secure cookies, XSRF, DNS Rebinding and etc. Has been used in production for many years so security is generally decent.

Templating Library

Templating Library
Uses its own templating engine. You could configure Django to use Jinja2 if you like.
Templating Library
Tornado uses custom templating library out of the box.

Web Forms

Web Forms
Ships with built-in ModelForms which provides complete support for web forms including input validation, CSRF, XSS, and SQL injection.
Web Forms
No built-in support.

Authentication

Authentication
Built-in authentication, authorization, account management and support for sessions.
Authentication
Provides user authentication and also supports 3rd party authentication and authorization systems like Google, Twitter, Facebook, etc.

Testing

Testing
Built-in support using Python's unittest framework.
Testing
Built-in support using Python's unittest framework.

If you found this useful, please help us grow by sharing this article with your followers using the sharing icons. Every share or call out will help. Thank you.

Similar Comparisons

Speak Your Mind