Flask
Flask is a lightweight Python web framework known for its minimalism, flexibility, and 'micro-framework' philosophy of providing only the core tools needed to build a web application.
Definition
Flask is a lightweight Python web framework known for its minimalism, flexibility, and 'micro-framework' philosophy of providing only the core tools needed to build a web application.
Overview
Flask was designed around the idea that a web framework should give developers a small, well-understood core rather than a large opinionated stack. It handles routing, request/response objects, and templating out of the box, while leaving decisions like database access, form validation, and project structure to the developer, who adds extensions as needed. This minimalism makes Flask popular for small services, prototypes, and teaching, since beginners can understand the entire framework's surface area quickly. It uses the Werkzeug WSGI toolkit and the Jinja2 templating engine under the hood, and a rich extension ecosystem (for databases, authentication, and REST APIs) lets it grow into more substantial applications when needed. Flask is frequently contrasted with more batteries-included frameworks like Django, and with the newer async-first FastAPI, which was partly inspired by Flask's simple routing style but adds automatic validation and async support. Flask applications are commonly containerized with Docker and deployed behind a WSGI server such as Gunicorn.
Key Features
- Minimal core with routing, requests, and Jinja2 templating built in
- Micro-framework design that avoids imposing a fixed project structure
- Large extension ecosystem for databases, auth, and REST APIs
- Built on the mature Werkzeug WSGI toolkit
- Easy to learn, making it a common choice for teaching web development
- Flexible enough to scale from single-file scripts to larger applications
- Straightforward integration with SQLAlchemy and other Python ORMs