Flask 3 · Templates, sessions and config
Loop in a template
Use Jinja control structures in the template.
{% for post in posts %}
<h2>{{ post.title }}</h2>
{% else %}
<p>No posts yet.</p>
{% endfor %}
Official Flask 3 documentation
More templates, sessions and config commands
- Render a template
- Share a layout
- Link to a static file
- Remember a user between requests
- Load configuration
- Show a one-time message
All templates, sessions and config commands · Flask 3 cheatsheet