Patrick's Software Blog

Deep Dive into Flask's Application and Request Contexts

Notebook on a table with the Flask log on the side and a Learning Plan in the notebook listing the Application Context and Request Context.

Introduction

This blog post provides a deep-dive exploration into the Application Context and Request Context in Flask. The key concepts covered are:

  • What a context is
  • Which data is stored in both the Application and Request contexts
  • The steps required for processing the Application and Request contexts when a request is handled in Flask
  • How proxies to the Application and Request context are used
  • How to utilize the current_app and request proxies in view functions
  • What a context-local is

The full article can be found on TestDriven.io: https://testdriven.io/blog/flask-contexts-advanced/