Wednesday, September 23, 2020

Patrick Kennedy: Application and Request Contexts in Flask

I wrote two blog posts on TestDriven.io about how the Application and Request contexts are handled in Flask:

  1. BasicsUnderstanding the Application and Request Contexts in Flask
  2. AdvancedDeep Dive into Flask’s Application and Request Contexts

The first blog post provides examples of how to the Application and Request contexts work, including how the current_app, request, test_client, and test_request_context can be used to effectively used to avoid pitfalls with these contexts.

The second blog post provides a series of diagrams illustrating how the Application and Request contexts are processed when a request is handled in Flask. This post also dives into how LocalStack objects work, which are the objects used for the Application Context Stack and the Request Context Stack.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...