Problems with a Global app Object
Why a single module-level app limits you.
The Tempting Shortcut
Most tutorials create app at the top of a module and use it everywhere. It feels simple, but that single global object quietly limits how your project can grow. 🌱
One App, Forever
A module-level app is built the moment the file is imported. You get exactly one instance, with one fixed configuration, baked in for the whole process.
from flask import Flask
app = Flask(__name__) # created on importAll lessons in this course
- Problems with a Global app Object
- Write a create_app Function
- Init Extensions with init_app
- Register Blueprints in the Factory