Open tangdu opened 6 years ago
I met this problem too. How to solve it?
Hi,
I also met this problem. After hours of debugging, I found the error may lie in the orgnization of the project. In my case, I created the __inti__.py
in a folder to make it as a package(say my_package). When I using a module in this package (say my_module), I forgot to add the package name when writing the import
statement.
Specificlly, I wrote from my_module import my_function
, but the right way is from my_package.my_module import my_function
.
Hope it helps.
Flask-Bootstrap does not provide a template called bootstrap/nav.html
, I guess you are using Bootstrap-Flask since the latter has the bootstrap/nav.html
template and the render_nav_item
macro.
Centos6.8
File "/usr/local/lib64/python3.6/site-packages/flask/templating.py", line 117, in _render rv = template.render(context) File "/usr/local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render return original_render(self, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise raise value.with_traceback(tb) File "/root/kunpeng/templates/config.html", line 1, in top-level template code {% extends 'base.html' %} {% block content %} File "/root/kunpeng/templates/base.html", line 1, in top-level template code {% from 'bootstrap/nav.html' import render_nav_item %} File "/usr/local/lib64/python3.6/site-packages/flask/templating.py", line 58, in get_source return self._get_source_fast(environment, template) File "/usr/local/lib64/python3.6/site-packages/flask/templating.py", line 86, in _get_source_fast raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: bootstrap/nav.html