[Python] Jinja2: render template inside template

Discussão em 'Python' iniciado por Stack, Junho 14, 2025.

  1. Stack

    Stack Membro Participativo

    Is it possible to render a Jinja2 template inside another template given by a string? For example, I want the string

    {{ s1 }}


    to be rendered to

    Hello world


    given the following dictionary as a param for Template.render:

    { 's1': 'Hello {{ s2 }}', 's2': 'world' }


    I know the similar process can be done with include tag separating the content of s1 to the another file, but here I don't want to follow that way.

    Continue reading...

Compartilhe esta Página