There are many Python web frameworks: Django, Flask, Pyramid, Bottle, Tornado, Pecan, Diesel, Falcon, and many more.
Django and Flask are very popular web frameworks.
In this article we’ll focus on Django and Flask.
Related course: Django Web Developer Course
Framework Size
Flask is a microframework. It provides the minimum to make a web app. This means it’s also faster to learn Flask than Django.
Django is heavier than the Flask framework, but provides more features.
Data storage
The Django framework uses an ORM by default (Object Relational Mapper). This maps classes to database tables.
The Flask framework leaves it up to developer. You can use it with SQLAlchemy, MongoDb or something more simple like SQLite.
That can be a better choice as an ORM is not a silver bullet, sometimes you waste development time because you can’t modify the SQL query directly.
Template system
Both Django and Flask have a template rendering system inspired by Jinja2.
Functionally they are the same, but they are slightly different. That difference means you can’t always copy templates from one system to another without issues.
Admin system
Django provides an admin system. It comes with the ORM database system and a directory structure.
There is an all inclusive experience with Django. That means that multiple Django projects will have the same directory structure.
Flask doesn’t have these features out of the box, to have an admin system or use an ORM you’ll need to install custom modules.