Skip to main content

stream_template_string

Render a template from the given source string with the given context as a stream. This returns an iterator of strings, which can be used as a streaming response from a view.

def stream_template_string(
source: str,
context: Any
) - > Iterator[str]

Render a template from the given source string with the given context as a stream. This returns an iterator of strings, which can be used as a streaming response from a view.

Parameters

NameTypeDescription
sourcestrThe source code of the template to render.
contextAnyThe variables to make available in the template.

Returns

TypeDescription
Iterator[str]An iterator of strings representing the rendered template chunks, suitable for streaming responses.