Flask 3 · Blueprints, database and CORS

Group routes in a blueprint

Split a large app into modules and register them with the app.

# users.py
bp = Blueprint("users", __name__, url_prefix="/users")

@bp.get("/")
def list_users():
    return []

# app.py
app.register_blueprint(bp)

Official Flask 3 documentation

More blueprints, database and cors commands

All blueprints, database and cors commands · Flask 3 cheatsheet

Was this page helpful?