Home / Function/ push() — flask Function Reference

push() — flask Function Reference

Architecture documentation for the push() function in ctx.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  519276e3_fb95_dd4f_f8b0_6550aeb8f81b["push()"]
  86817dcd_97b5_9a9f_aee8_5fa78b4cecc9["AppContext"]
  519276e3_fb95_dd4f_f8b0_6550aeb8f81b -->|defined in| 86817dcd_97b5_9a9f_aee8_5fa78b4cecc9
  fb0e1e8e_33b2_bf68_f1ae_2eace5216191["wsgi_app()"]
  fb0e1e8e_33b2_bf68_f1ae_2eace5216191 -->|calls| 519276e3_fb95_dd4f_f8b0_6550aeb8f81b
  5b74ca59_5b16_8055_3522_e83982aa2ae6["__enter__()"]
  5b74ca59_5b16_8055_3522_e83982aa2ae6 -->|calls| 519276e3_fb95_dd4f_f8b0_6550aeb8f81b
  5f896cf4_e98f_e9ed_264e_d22af8ed8eec["match_request()"]
  519276e3_fb95_dd4f_f8b0_6550aeb8f81b -->|calls| 5f896cf4_e98f_e9ed_264e_d22af8ed8eec
  style 519276e3_fb95_dd4f_f8b0_6550aeb8f81b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/ctx.py lines 409–430

    def push(self) -> None:
        """Push this context so that it is the active context. If this is a
        request context, calls :meth:`match_request` to perform routing with
        the context active.

        Typically, this is not used directly. Instead, use a ``with`` block
        to manage the context.

        In some situations, such as streaming or testing, the context may be
        pushed multiple times. It will only trigger matching and signals if it
        is not currently pushed.
        """
        self._push_count += 1

        if self._cv_token is not None:
            return

        self._cv_token = _cv_app.set(self)
        appcontext_pushed.send(self.app, _async_wrapper=self.app.ensure_sync)

        if self._request is not None and self.url_adapter is not None:
            self.match_request()

Subdomains

Defined In

Frequently Asked Questions

What does push() do?
push() is a function in the flask codebase, defined in src/flask/ctx.py.
Where is push() defined?
push() is defined in src/flask/ctx.py at line 409.
What does push() call?
push() calls 1 function(s): match_request.
What calls push()?
push() is called by 2 function(s): __enter__, wsgi_app.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free