0Pricing
Flask Academy · Lesson

Write a create_app Function

Construct and configure the app inside a factory.

Meet the Factory

An application factory is just a function named create_app that builds a fresh Flask app, configures it, and returns it. No globals required. 🏭

The Smallest Factory

At its core, create_app creates the app inside the function body and returns it. Everything you used to do at module level moves in here.

def create_app():
    app = Flask(__name__)
    return app

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