Introduction
Django (covered earlier) gives you everything: an ORM, an admin panel, authentication, and a project structure, decided for you. Flask, created by Armin Ronacher in 2010, gives you almost nothing β routing, request handling, and a template engine β and lets you add the rest yourself. That minimalism is the point: for small apps, APIs, and learning, a framework that stays out of the way teaches you more than one that does everything.
A complete app in a few lines
Flask's famous "hello world" is a whole working web app:
from flask import Flask
app = Flask ( __name__ )
@app.route ( " / " ) def home (): return " Hello, Flask! "
@app.route ( " /users/<name> " ) def greet ( name ): return f " Hello, { name } ! "
Enter fullscreen mode
Exit fullscreen mode
The @app.route decorator maps a URL to a function, <name> captures part of the URL as a variable, and returning a string sends it as the response.β¦