Create a gist now

Instantly share code, notes, and snippets.

pass mustache template into jinja template
from flask import Flask, render_template_string, request
app = Flask(__name__)
app.config['DEBUG'] = True
def index():
#of course you would put these into files
jinja_template = """
{# this is a jinja2 comment #}
{% block stuff %}
{% for i in range(5) %}
<p>Hello {{ name }}!</p>
{% endfor %}
{{ mustache_template }}
{% endblock %}
mustache_template = """
<li><a href="{{url}}">{{name}}</a></li>
return render_template_string(jinja_template,
name=request.values.get('name', 'world')
if __name__ == "__main__":, use_reloader=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment