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

All templates, sessions and config commands · Flask 3 cheatsheet

Was this page helpful?