Python is general purpose, high level scripting language. It is known for it’s elegant syntax, readability and productivity. As it is said, python is general purpose programming language such that it can be used to create backend web applications. For web development among other frameworks and libraries both Django and Flask are quite popular. Where, Django is the full blown web development framework tend to offer most of the stuff out of the box while Flask is light weight and referred as microframework.
Comparison between Django and Flask is as follows
Django | Flask |
---|---|
Django is the web development Framework | Flask is lightweight WSGI web application framework. It is referred as microframework for web development |
Django was created in 2005 | Flask was created in 2010 |
Django is Open Source | Flask is also Open Source Project |
Django is known for rapid development, extensive documentation and great community | Flask is known for lightweight, less code for development, and flexibility |
Official website of Django: Django | Official Website of Flask: Flask . |
Django is distributed under BSD-3 Clause “New” or “Revised” License | Flask is distributed under BSD-3 Clause “New” or “Revised” License |
Django official Git repositories: Github/Django | Flask Git Repository: github/flask |
Django is based on MVT (Model View and Template) | Flask is microframework. It is a wrapper around Werkzeug . |
Relatively compared to Flask, Django has steep learning curve | Quick and easy to get started |
Django has batteries included, it tend to provides routing, templating and Models etc out of the box | Flask is the wrapper around WSGI it offers core functionality for other components like templating, ORM we have to use libraries Example: Jinja for templating, sqlArchamy for ORM |
It is the framework, Less Flexible | Flask is microframework offers more flexibility |
Predefined Project Layout | Flask doesn’t enforce using any project layout |
Project layout is conventional and created by bootstrapping tool django-admin | Project Layout is upto the developer |
Project Layout is created by builtin bootstrapping tools django-admin and manage.py commands | No bootstrapping tool is available, project layout is random and upto developer |
Batteries are included, developer is confined how Django does it and using what Django has to offer | Flask doesn’t constrain developers to use of any dependencies. Developer has freedom to choose any tools and libraries |
Django doesn’t offers visual debugging | Flask offers visual debugging |
Django comes with builtin Template Engine | For Flask external template engine/library Jinja is used |
Django has builtin support for ORM | For Flask sqlArchmey is used for ORM |
To start development server: python manage.py runserver | To run flask development server: flask –app myapp run Where, myapp is the module having Flask instance (app) |
Library of Django Apps, Frameworks and Projects: Django Packages . | List of tools and libraries to support your development with flask: awesome-flask . |
Following table gives the comparison on how things are handled in Django and Flask
Django | Flask | |
---|---|---|
Language | Python | Python |
Web Framework | Full-stack | Micro |
Templating | Django Template Language | Jinja2 |
ORM | Django ORM | No Built-in ORM |
Admin Interface | Built-in | No Built-in Support |
Routing | URL patterns | Decorator |
Auto Reloading | Yes | Yes |
Scalability | Designed to be scalable | Needs additional libraries |
Learning Curve | Steep | Quick |
Leave a Reply