Home / Function/ render_template() — flask Function Reference

render_template() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7e7aa0ff_440d_2f5c_935b_74471945ad50["render_template()"]
  554becd3_25b5_c670_a654_7a20377dec19["templating.py"]
  7e7aa0ff_440d_2f5c_935b_74471945ad50 -->|defined in| 554becd3_25b5_c670_a654_7a20377dec19
  b7db9b24_d5be_a8c2_55fe_26b8b73ffe93["_get_current_object()"]
  7e7aa0ff_440d_2f5c_935b_74471945ad50 -->|calls| b7db9b24_d5be_a8c2_55fe_26b8b73ffe93
  d39cf1b5_5a41_f48f_3c8e_c8e0ac439c62["_render()"]
  7e7aa0ff_440d_2f5c_935b_74471945ad50 -->|calls| d39cf1b5_5a41_f48f_3c8e_c8e0ac439c62
  style 7e7aa0ff_440d_2f5c_935b_74471945ad50 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/templating.py lines 135–147

def render_template(
    template_name_or_list: str | Template | list[str | Template],
    **context: t.Any,
) -> str:
    """Render a template by name with the given context.

    :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.
    """
    ctx = app_ctx._get_current_object()
    template = ctx.app.jinja_env.get_or_select_template(template_name_or_list)
    return _render(ctx, template, context)

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free