DEV Community

brendan for Kite

Posted on • Updated on • Originally published at

Flask vs Django

Flask vs Django

Flask or Django?

According to the 2018 Python Developers Survey, Flask and Django are, by far, the most popular web frameworks for Python developers. You’ll hardly go wrong with either framework if you’re deciding which one to use for a new web application. While it’s up to you to figure out which one works best for what you’re trying to accomplish, there’s a few major differences you should be aware of when making the decision. Regardless of which framework you end up using, both are very well documented and widely used, so they have ample active and supportive communities. So, without further ado, let’s take a look at what each framework offers and highlight some of their differences and similarities.

TL;DR Flask vs Django Differences

Flask and Django are mature, extensible web frameworks that, at their core, offer similar functionality in handling requests and serving up documents, but differ in their scope of responsibility. Most of the differences between the 2 frameworks stem from this different approach although some also stem from some different core design decisions. Here is a short list of key differences that might impact your decision:

  • The Request Object - Flask uses thread-locals while Django passes the request around where it’s needed.
  • Forms - Django comes with them built-in and they integrate with the ORM and the admin site. Flask has no default support for forms, but you can use WTForms to fill the gap.
  • The Database - Django comes with the Django ORM and a migration system that wants to manage your database. Flask makes no assumptions about a database, but there are tools out there, like SQLAlchemy that provide similar functionality (perhaps more).
  • Authentication & Permissions - Django comes with an authentication app that gives a default implementation for user management and permissions. Flask provides secure cookies as a tool for your own implementation.
  • Admin Site - Django comes with a fully integrated admin interface for managing application data. Flask doesn’t come with anything like it, but Flask-Admin is a popular extension that can be used to create a similar admin tool.

Read more on the Kite blog!

Top comments (0)