0Pricing
Flask Academy · Lesson

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 import

All lessons in this course

  1. Problems with a Global app Object
  2. Write a create_app Function
  3. Init Extensions with init_app
  4. Register Blueprints in the Factory
← Back to Flask Academy