Home / Function/ stream_template() — flask Function Reference

stream_template() — flask Function Reference

Architecture documentation for the stream_template() function in templating.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  15d02cdb_c023_0b6d_4bca_4b5aaa9f0a48["stream_template()"]
  554becd3_25b5_c670_a654_7a20377dec19["templating.py"]
  15d02cdb_c023_0b6d_4bca_4b5aaa9f0a48 -->|defined in| 554becd3_25b5_c670_a654_7a20377dec19
  b7db9b24_d5be_a8c2_55fe_26b8b73ffe93["_get_current_object()"]
  15d02cdb_c023_0b6d_4bca_4b5aaa9f0a48 -->|calls| b7db9b24_d5be_a8c2_55fe_26b8b73ffe93
  7e368e93_5307_3273_cf9b_b38ace3d5f4d["_stream()"]
  15d02cdb_c023_0b6d_4bca_4b5aaa9f0a48 -->|calls| 7e368e93_5307_3273_cf9b_b38ace3d5f4d
  style 15d02cdb_c023_0b6d_4bca_4b5aaa9f0a48 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/templating.py lines 180–196

def stream_template(
    template_name_or_list: str | Template | list[str | Template],
    **context: t.Any,
) -> t.Iterator[str]:
    """Render a template by name with the given context as a stream.
    This returns an iterator of strings, which can be used as a
    streaming response from a view.

    :param template_name_or_list: The name of the template to render. If
        a list is given, the first name to exist will be rendered.
    :param context: The variables to make available in the template.

    .. versionadded:: 2.2
    """
    ctx = app_ctx._get_current_object()
    template = ctx.app.jinja_env.get_or_select_template(template_name_or_list)
    return _stream(ctx, template, context)

Subdomains

Frequently Asked Questions

What does stream_template() do?
stream_template() is a function in the flask codebase, defined in src/flask/templating.py.
Where is stream_template() defined?
stream_template() is defined in src/flask/templating.py at line 180.
What does stream_template() call?
stream_template() calls 2 function(s): _get_current_object, _stream.

Analyze Your Own Codebase

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

Try Supermodel Free