flask开发中遇到 Encountered unknown tag 'endblock'

flask开发中遇到 Encountered unknown tag 'endblock',第1张

概述flask开发中遇到 Encountered unknown tag 'endblock'

flask开发中遇错误,提示如下

jinja2.exceptions.TemplateSyntaxError jinja2.exceptions.TemplateSyntaxError: Encountered unkNown tag 'endblock'.You probably made a nesting mistake. Jinja is expecting this tag, but currently looking for 'elif' or 'else' or 'endif'.The innermost block that needs to be closed is 'if'.

这句话的意思是:遇到未知的‘板块’,这个板块是if

{% extends "base.HTML" %}{% import "bootstrap/wtf.HTML" as wtf %}{% import '_marcos.HTML' as macros %}{% block Title %}Flasky{% endblock %}{% block page_content %}<div >    <h1>Hello, {% if current_user.is_authenticated %}{{ current_user.username }}{% else %}Stranger{% endif %}!</h1></div><div>    {% if current_user.can(Permission.WRITE_ARTICLES) %}    {{ wtf.quick_form(form) }}    {% endif %}</div>{% include '_posts.HTML' %}    {% if pagination %}        <div >        {{ macros.paginnation_Widget(pagination, ".index") }}        </div>{% endblock %}

经过检查发现{% if pagination %} 少了一个结束,所以代码应该为:

{% include '_posts.HTML' %}    {% if pagination %}        <div >        {{ macros.paginnation_Widget(pagination, ".index") }}        </div>    {% endif %}{% endblock %}


总结

以上是内存溢出为你收集整理的flask开发中遇到 Encountered unknown tag 'endblock'全部内容,希望文章能够帮你解决flask开发中遇到 Encountered unknown tag 'endblock'所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/1198445.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-03
下一篇2022-06-03

发表评论

登录后才能评论

评论列表(0条)

    保存