Reputation: 791
I'm a newbie experimenting with Flask/Jinja2 and SQL-Alchemy.
I have a question about html output when using Jinja2 templating.
My view function looks like this:
from app import app
from flask import render_template
from init_database import init_db
from app.models import Provider
@app.route('/update')
def update():
provider = Provider.query.get_or_404(1)
return render_template("update.html", provider=provider)
And my template looks like this:
{% extends "layout.html" %}
{% block content %}
<div class="page">
<ul>
{ % for provider in prov %}
<li>
{{ provider.nzbprovider }}
{{ provider.rssfeed }}
</li>
{ % endfor %}
</ul>
</div>
{% endblock %}
When I run the app, the out looks like this in the browser:
{ % for provider in prov %}
Peter Johnson
Michael Manning
{ % endfor %}
Why does it display the Jinja tags? What have I forgotten?
Upvotes: 1
Views: 249
Reputation: 30033
You have spaces in the Jinja tag delimiters: Change { %
(with a space) to {%
(with no space)
Upvotes: 2