Path 1: 552 calls (1.0)

AppContext (552)

1def app_context(self) -> AppContext:
2        """Create an :class:`~flask.ctx.AppContext`. Use as a ``with``
3        block to push the context, which will make :data:`current_app`
4        point at this application.
5
6        An application context is automatically pushed by
7        :meth:`RequestContext.push() <flask.ctx.RequestContext.push>`
8        when handling a request, and when running a CLI command. Use
9        this to manually create a context outside of these situations.
10
11        ::
12
13            with app.app_context():
14                init_db()
15
16        See :doc:`/appcontext`.
17
18        .. versionadded:: 0.9
19        """
20        return AppContext(self)