Context Locals and Thread Safety
How proxies stay correct across requests.
The Magic Question
How does one global request object stay correct when many visitors hit your app at once? The answer is context locals.
They Look Global
Objects like request and g look like plain globals you import once. But they are special proxies, not ordinary shared variables.
from flask import requestAll lessons in this course
- App Context vs Request Context
- current_app and the g Object
- Context Locals and Thread Safety
- Push a Context in Scripts and Shells