What Is Flask?
Flask is a lightweight WSGI micro web framework for Python, created by Armin Ronacher, that gives you routing, request/response handling, and templating out of the box while leaving choices like ORM, auth, and project layout up to you.
Cricket analogy: Flask is like a school cricket team that hands you a bat, ball, and stumps but lets you decide your own batting order and field placements, unlike a franchise like Mumbai Indians with a full backroom staff dictating every strategy.
Why Choose Flask?
Developers choose Flask because it has a small, understandable core (a single module you can read in an afternoon), minimal boilerplate to get a server running, and an extension ecosystem (Flask-SQLAlchemy, Flask-Login, Flask-Migrate) that lets you add exactly the capabilities a project needs without bundling unused features.
Cricket analogy: Choosing Flask over a heavier framework is like Rahul Dravid choosing a lightweight bat suited to his technical, get-in-get-out style rather than the heavy blade a power hitter like Andre Russell prefers for six-hitting.
Flask vs Other Frameworks
Compared to Django, which ships with an admin panel, ORM, and authentication system baked in, Flask is unopinionated: you assemble your own stack, which suits small APIs, prototypes, and services where a full-featured framework would be overkill; FastAPI, by contrast, targets async, type-hinted APIs with automatic OpenAPI docs, whereas Flask remains synchronous-first (though it supports async views since 2.0) and prioritizes simplicity over built-in validation.
Cricket analogy: Flask versus Django is like choosing a nimble T20 specialist squad versus a full Test-match setup with specialist coaches for every discipline — Django, like an IPL franchise, arrives fully staffed, while Flask lets you build the XI yourself.
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Hello, Flask!"
if __name__ == "__main__":
app.run(debug=True)Flask is built on top of Werkzeug (a WSGI toolkit) and Jinja2 (a templating engine) — two libraries also created by Armin Ronacher's Pocoo team, which is why Flask's routing and templating feel so cohesive.
- Flask is a micro web framework for Python built on Werkzeug and Jinja2.
- It ships with routing, request/response handling, and templating, but leaves ORM, auth, and structure to the developer.
- Extensions like Flask-SQLAlchemy and Flask-Login add functionality without bloating the core.
- Django is a full-stack, batteries-included alternative; FastAPI targets async, type-hinted APIs.
- Flask supports async views since version 2.0 but remains synchronous-first.
- Its small, readable codebase makes it easy to understand exactly what's happening under the hood.
Practice what you learned
1. Who created Flask?
2. Which two libraries does Flask build directly on top of?
3. What does "micro" in micro-framework mean for Flask?
4. Since which major version does Flask support async view functions?
5. Which framework ships with a built-in admin panel and ORM, unlike Flask?
Was this page helpful?
You May Also Like
Creating a Flask Application
Learn to set up a Flask project with a virtual environment, understand the central application object, and run the development server safely.
Routing in Flask
Understand how @app.route binds URLs to view functions, how dynamic URL converters validate input, and how to handle HTTP methods and generate URLs with url_for.
Flask Application Structure
Learn how to organize a growing Flask project using the application factory pattern, Blueprints for modularity, and conventional templates/static/config layouts.
Related Reading
Related Study Notes in Web Development
Browse all study notesWebSockets Study Notes
Web Development · 30 topics
Web DevelopmentWebAssembly Study Notes
WebAssembly · 30 topics
Web DevelopmentgRPC Study Notes
Protocol Buffers · 30 topics
Web DevelopmentSpring Boot Study Notes
Java · 30 topics
Web DevelopmentDjango Study Notes
Python · 30 topics
Web DevelopmentNext.js Study Notes
JavaScript · 30 topics