← All open source projects

Flask

pallets/flask

Flask is a Python microframework for web applications: routes, request/response handling, Jinja, and extensible server foundations.

Forks 16,874
Author pallets
Language Python
License BSD-3-Clause
Synced 2026-06-11

What it is

Flask is a microframework for Python web applications. It provides routes, request objects, responses, Jinja templates, and basic application structure without forcing an ORM, admin panel, or one architecture.

The pallets/flask repository has been on GitHub since 2010. It belongs to the Pallets ecosystem, uses the BSD-3-Clause license, and builds on Werkzeug and Jinja.

What is inside

Inside are the Flask core, tests, documentation, examples, and integration with Pallets libraries. Its philosophy is a small core with extensions around it.

Minimal app

This example shows the core idea: a route connects a URL to a Python function that returns a response.

Language: Python
from flask import Flask

app = Flask(__name__)

@app.get("/")
def index():
    return {"status": "ok"}

Where it helps

Flask works well for APIs, internal services, prototypes, learning apps, and small backends where the team wants control over library choices.

Flask began as a small, understandable foundation for web applications where the developer chooses the rest. That created a culture of adding only what is needed: one library for the database, another for forms, another for authentication if the project requires it.

This works well for services with clear server logic: small APIs, internal tools, webhooks, prototypes, and experimental dashboards. An app can start in one file and move into modules once the structure becomes clear.

The flexibility requires discipline. In a large Flask project, the team owns module boundaries, environment configuration, migrations, error handling, and tests. Without those rules, minimalism stops helping and starts hiding disorder.

Project details

Flask is often chosen because it starts clearly. A minimal app fits in a few lines, but that does not make it a toy: the same routing, request, and response model can grow into a full service.

The Pallets ecosystem matters for understanding Flask. Werkzeug provides the lower-level web foundation, Jinja handles templates, and Flask ties those parts into a convenient application model. That keeps the project small but not isolated.

Blueprints help split an application once a single file is no longer comfortable. This is a good example of Flask’s philosophy: structure is not imposed early, but tools for growth exist. A team can start simply and add organization when needed.

For APIs, Flask is convenient because it does not force many decisions at once. Start with routes and JSON responses, then add validation, database access, authentication, background tasks, and tests. The price of freedom is choosing those components yourself.

In large projects, Flask requires more discipline than frameworks with a strict architecture. Layers, error handling, configuration, migrations, and tests have to be agreed on. If the team does that, minimalism is an advantage; if not, the project spreads out.

Strengths and tradeoffs

The strength is simplicity and flexibility. The tradeoff is that large apps need local rules for module structure, validation, database access, authorization, migrations, and tests.