第八章程序运行出现UndefinedError: the template 'bootstrap/pagination.html' (imported on line 2 in 'blog/index.html') does not export the requested name 'render_pager'错误

在配置第八章程序的过程中,出现了一下错误
jinja2.exceptions.UndefinedError: the template 'bootstrap/pagination.html' (imported on line 2 in 'blog/index.html') does not export the requested name 'render_pager'

Traceback (most recent call last):
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 2309, in call
return self.wsgi_app(environ, start_response)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask_![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)compat.py", line 35, in reraise
raise value
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask_![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)compat.py", line 35, in reraise
raise value
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask_debugtoolbar_init_.py", line 125, in dispatch_request
return view_func(**req.view_args)
File "D:\bluelog\bluelog\blueprints![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)blog.py", line 26, in index
return render_template('blog/index.html', pagination=pagination, posts=posts)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)templating.py", line 135, in render_template
context, ctx.app)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\flask![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)templating.py", line 117, in _render
rv = template.render(context)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\jinja2![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\jinja2![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\jinja2![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "c:\users\常笑妍.virtualenvs\bluelog-yniw-osi\lib\site-packages\jinja2_![](file:///C:\Users\lenovo\AppData\Local\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "D:\bluelog\bluelog\templates\blog\index.html", line 2, in top-level template code
{% from 'bootstrap/pagination.html' import render_pager %}
File "D:\bluelog\bluelog\templates\base.html", line 81, in top-level template code
{% block content %}{% endblock content %}
File "D:\bluelog\bluelog\templates\blog\index.html", line 15, in block "content"
<div class="page-footer">{{ render_pager(pagination) }}</div>
jinja2.exceptions.UndefinedError: the template 'bootstrap/pagination.html' (imported on line 2 in 'blog/index.html') does not export the requested name 'render_pager'
重新配置依旧是这个错误

可以执行 pipenv run pip show bootstrap-flask 命令看一下对应输出。

再次提醒,请为帖子选择合适的分类,不要使用默认分类。代码块、命令行输出和错误输出要作为代码块进行格式化。标题中如果错误信息太长可以适当删减不重要信息。

运行了以后的结果是这个
Name: Bootstrap-Flask
Version: 1.0.10
Summary: Bootstrap helper for Flask/Jinja2.
Home-page: https://github.com/greyli/bootstrap-flask
Author: Grey Li
Author-email: withlihui@gmail.com
License: MIT
Location: c:\users\lenovo.virtualenvs\bluelog-yniw-osi\lib\site-packages
Requires: Flask
Required-by:
其实这是我帮我朋友在配置这个环境,在我的电脑上都没有问题,但是她的电脑就是会出现错误。

发现现在的错误是,就是我如果用flask initdb 然后运行flask run我就可以运行成功,但是进去这个博客是没有数据的,但是当我重新再用flask forge在运行flask init初始化管理员然后在运行flask run就会出现这个错误,所以我想肯定是flask forge这一块出了问题!但是怎么想也没想出来问题是什么。