【问题标题】:jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got 'text'jinja2.exceptions.TemplateSyntaxError:预期的令牌'语句块结束',得到'文本'
【发布时间】:2018-01-23 05:53:51
【问题描述】:
{{% extends "base.html %}

{% block content %}
<h1 style="text-align: center">Owner Index</h1>


<fieldset align="centre">
    <body>
    {% for value in p %}
    {{ value.id }}<br>
    {{ value.start_location }}<br>
    {{ value.start_time }}<br>
    {{ value.drop_location }}<br>
    {{ value.car_model }}<br>
    {{ value.car_number}}<br>
    {% endfor %}
    </body>
</fieldset>
{% endblock %}

我正在尝试打印从 python 发送到 p 中的值,但总是收到此错误。

【问题讨论】:

  • 第一行中额外的大括号实际上是否在您的代码中?这可能会导致语法错误

标签: python html


【解决方案1】:

替换此行

{{ extends "base.html %}

用这条线

{% extends "base.html" %}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-11
    • 2022-12-18
    • 1970-01-01
    • 2022-09-22
    • 1970-01-01
    • 2018-12-04
    相关资源
    最近更新 更多