0PricingLogin
Flask Academy · Lesson

App Context vs Request Context

Two contexts and what lives in each.

Two Kinds of Context

Flask runs your code inside a context, a temporary bubble holding the data your view needs. There are two flavors: an app context and a request context.

The App Context

The application context tracks which app is active right now. It exists whenever Flask is doing work, even outside a real web request.

All lessons in this course

  1. App Context vs Request Context
  2. current_app and the g Object
  3. Context Locals and Thread Safety
  4. Push a Context in Scripts and Shells
← Back to Flask Academy