I've read flask document and found this:
13.3 Locality of the Context
The application context is created and destroyed as necessary. It never moves between threads and it will not be shared between requests.
This is really odds to me. I think an app context should be persist with the app and share objects for all the requests of the app.
So I dive into the source code and find that when the request context is pushed , an application context will be created and pushed if current app is not the one the request associated with.
So it seems that the app context stack may have multiple different app context for the same app pushed? Why not using a singleton app context? Why the lifetime of the app context is so 'short'? What can be done for such app context?