4.2 AppContext、RequestContext、Flask与Request之间的关系
1.定位AppContext、RequestContext
def __init__(self, app):
self.app = app
self.url_adapter = app.create_url_adapter(None)
self.g = app.app_ctx_globals_class()
# Like request context, app contexts can be pushed multiple times
# but there a basic "refcount" is enough to track them.
self._refcnt = 0def push(self):
...
def pop(self, exc=_sentinel):
...
def __enter__(self):
...
def __exit__(self, exc_type, exc_value, tb):
...2.为什么需要上下文
3.对AppContext、RequestContext、Flask与Request的意义做出一个解释
Last updated
Was this helpful?

