Skip to main content

render_template_string

Render a template from the given source string with the given context.

def render_template_string(
source: str,
context: t.Any
) - > str

Render a template from the given source string with the given context.

Parameters​

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

Returns​

TypeDescription
strThe rendered template as a string.