Flask 3 · Blueprints, database and CORS

Use an application factory

Create the app in a function, which makes testing and configuration easier.

def create_app():
    app = Flask(__name__)
    app.config.from_prefixed_env()
    app.register_blueprint(bp)
    return app

Official Flask 3 documentation

More blueprints, database and cors commands

All blueprints, database and cors commands · Flask 3 cheatsheet

Was this page helpful?