flask web教程 第十一章,添加博客文章 报错UndefinedError: 'Permission' is undefined

我根据github源码来的怎么还出错了,已经更新了数据库。访问首页就报错了

            Traceback (most recent call last)

File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1997, in call
return self.wsgi_app(environ, start_response)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_compat.py", line 33, in reraise
raise value
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_compat.py", line 33, in reraise
raise value
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "E:\zt_6.27\pictureme\app\main\views.py", line 20, in index
return render_template('index.html', form=form, posts=posts)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\templating.py", line 134, in render_template
context, ctx.app)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask\templating.py", line 116, in _render
rv = template.render(context)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "E:\zt_6.27\pictureme\app\templates\index.html", line 2, in top-level template code
{% import "bootstrap/wtf.html" as wtf %}
File "E:\zt_6.27\pictureme\app\templates\base.html", line 1, in top-level template code
{% extends "bootstrap/base.html" %}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 1, in top-level template code
{% block doc -%}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 4, in block "doc"
{%- block html %}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 20, in block "html"
{% block body -%}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 23, in block "body"
{% block content -%}
File "E:\zt_6.27\pictureme\app\templates\base.html", line 58, in block "content"
{% block page_content %}{% endblock %}
File "E:\zt_6.27\pictureme\app\templates\index.html", line 11, in block "page_content"
{% if current_user.can(Permission.WRITE) %}
File "E:\zt_6.27\pictureme\flask\lib\site-packages\jinja2\environment.py", line 430, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'Permission' is undefined

求大神解答一下!!!!

2个回答

zhangtao0417
本人爱搞小玩意 额,大佬,答非所问啊,虽然都是undefined,但是不同项目环境的也没用啊,我想问一下接触过flask web教程这本书的大佬们有没有遇到类似的错误
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问