0 votes
in Python Flask by
What is the application context in Flask?

1 Answer

0 votes
by

The application context in Flask relates to the idea of a complete request/response cycle. It keeps a track of application-level data during a request or a CLI command. We make use of g and current_app proxies to achieve the same.

There are situations when it is difficult to directly import the Flask app, such as in the case of a Flask extension or a Blueprint. Moreover, introducing applications may raise the problem of circular imports.

Flask pushes the application context with each request. Therefore, during a request, functions have access to g and current_app to overcome the problem highlighted above.

Related questions

0 votes
asked Dec 23, 2022 in Python Flask by john ganales
0 votes
asked Dec 24, 2022 in Python Flask by sharadyadav1986
...