Compare Django and web2py
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.
web2py was originally designed as a teaching tool, but it gained adoption outside of the academic world. It is a full-stack framework containing all the components needed to build fully functional web applications using the Model View Controller (MVC) pattern. Inspired by the Ruby on Rails and Django. It is not very popular right now but was ranked amongst top Python web frameworks in 2011.
Let's see how Django and web2py compare on various factors and features and which to choose when.
Python all-inclusive, megaframework for building web application.
Python full-stack for building web applications.
Used by 367,000 projects.
Instagram, Pinterest, Coursera, Udemy.
Not in use at any large company.
2074 job openings which list Django as a requirement.
8 job openings which list web2py as a requirement.
Not as fast as compared to bare-bones Flask or other microframeworks, but for many real-world use cases, the difference is negligible.
Web2py takes a unique approach where models and controllers are executed in a single global environment, which is initialized at each HTTP request. While there are pros to this approach, such as developers never having to worry about cleaning up or avoid conflict between requests, the major disadvantage is that the code is models is executed with every request which carries a performance penalty.
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.
Not as flexible as microframeworks, but doesn't always get in the way.
Ease of Learning
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
Limited online tutorials and resources, and many are several years old. The best resource for learning is web2py author's own "web2py Complete Reference Manual"
, which seems to be written in 2013.
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.
Ships with a Database Abstraction Layer (DAL) which supports MySQL, PostgreSQL, SQLite, and many other relational databases.
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.
No built-in support. Very limited support for NoSQL databases. Currently, it only supports Google Datastore on the Google App Engine.
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.
Yes ships with a built-in admin panel.
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.
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
are released quickly.
Built-in protection against input injections, XSS, and common vulnerabilities. Read more here
. It has known security vulnerabilities. Please see list here
Ships with built-in ModelForms
which provides complete support for web forms including input validation, CSRF, XSS, and SQL injection.
Built-in support. Read more here
, authorization, account management and support for sessions.
Built-in support using Python's unittest
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.