【发布时间】:2017-06-27 07:16:53
【问题描述】:
我正在开发一个需要登录的 flask-sqlalchemy webapp。 仅当用户登录时,注销按钮才应在页面上可见。 所以所有这些页面都扩展了 layout.html 文件,如下所示:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Login</title>
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
{% block head %} {% endblock %}
</head>
<body>
{% block body %}
<style type="text/css">
#footer {
position : absolute;
bottom : 0;
}
</style>
{ % if session['logged_in'] %}
<div id="footer" style="width:300px;height:100px"><a href=" {{url_for('logout')}}" style="width:100%;background:#f1f1f1;">Logout</a></div>
{% endif %}
{% endblock %}
<script src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
</body>
</html>
我得到的错误是:
TemplateSyntaxError:遇到未知标签“endif”。金贾是 寻找以下标签:'endblock'。
需要关闭的最里面的块是'block'。
虽然已经指定了 endblock 和 if 标签 请帮我解决这个问题
【问题讨论】:
标签: python html flask-sqlalchemy