@@ -38,8 +38,8 @@ Purpose of the Application Context
38
38
----------------------------------
39
39
40
40
The main reason for the application's context existence is that in the
41
- past a bunch of functionality was attached to the request context in lack
42
- of a better solution. Since one of the pillar's of Flask's design is that
41
+ past a bunch of functionality was attached to the request context for lack
42
+ of a better solution. Since one of the pillars of Flask's design is that
43
43
you can have more than one application in the same Python process.
44
44
45
45
So how does the code find the “right” application? In the past we
@@ -48,17 +48,17 @@ with libraries that were not designed with that in mind.
48
48
49
49
A common workaround for that problem was to use the
50
50
:data: `~flask.current_app ` proxy later on, which was bound to the current
51
- request's application reference. Since however creating such a request
52
- context is an unnecessarily expensive operation in case there is no
53
- request around, the application context was introduced.
51
+ request's application reference. Since creating such a request context is
52
+ an unnecessarily expensive operation in case there is no request around,
53
+ the application context was introduced.
54
54
55
55
Creating an Application Context
56
56
-------------------------------
57
57
58
- To make an application context there are two ways . The first one is the
59
- implicit one : whenever a request context is pushed, an application context
60
- will be created alongside if this is necessary. As a result of that , you
61
- can ignore the existence of the application context unless you need it.
58
+ There are two ways to make an application context . The first one is
59
+ implicit: whenever a request context is pushed, an application context
60
+ will be created alongside if this is necessary. As a result, you can
61
+ ignore the existence of the application context unless you need it.
62
62
63
63
The second way is the explicit way using the
64
64
:meth: `~flask.Flask.app_context ` method::
@@ -91,9 +91,9 @@ For more information about that, see :ref:`extension-dev`.
91
91
Context Usage
92
92
-------------
93
93
94
- The context is typically used to cache resources on there that need to be
95
- created on a per-request or usage case. For instance database connects
96
- are destined to go there. When storing things on the application context
94
+ The context is typically used to cache resources that need to be created
95
+ on a per-request or usage case. For instance, database connections are
96
+ destined to go there. When storing things on the application context
97
97
unique names should be chosen as this is a place that is shared between
98
98
Flask applications and extensions.
99
99
0 commit comments