Daliy Note
Jinja
Raziel
2021. 7. 25. 20:02
Docs #
# Jinja2 Librury: Flask Template Engine
# Types
String, XML, HTML, JSON, Image, Video, etc
# example
{% extends "application.html" %}
{% block body %}
<ul>
{% for song in songs %}
<li><a href="{{song.url}}"> {{song.title}} </a></li>
{% endfor %}
</ul>
{% endblock %}
render_template("xx.html", username="Jade")
{# comment #}
from flask import render_template
@app.route("/")
def tmpl():
return render_template("index.html")
# ./templates/index.html
<pre>
ttt 한글
{% if True %}
TTT
{% endif %}qqq
</pre>
# trim_blocks app config
app.jinja_env.trim_blocks = True