The Jinga2 template engine uses the following delimiters for escaping from HTML.
We can use this:
- {% ... %} for Statements
- {{ ... }} for Expressions to print to the template output
- {# ... #} for Comments not included in the template output
- # ... ## for Line Statements
I create a new HTML5 file named layout.html and I will use this like an example:
{% if current_user.is_authenticated %}
...
{% else %}
...
{% endif %}
This file can be add into another file like this:{% extends "layout.html" %}
{% block content %}
...
{% endblock content %}
For example, my about.html webpage comes with this source code:{% extends "layout.html" %}
{% block content %}
About Page
{% endblock content %}
The routes.py this webpage will have this call:@app.route("/about")
def about():
return render_template('about.html', title='About')
In this way, I will add more HTML5 files to the project.