Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jinja2.exceptions.TemplateNotFound: bootstrap/nav.html #187

Open
tangdu opened this issue Aug 23, 2018 · 3 comments
Open

jinja2.exceptions.TemplateNotFound: bootstrap/nav.html #187

tangdu opened this issue Aug 23, 2018 · 3 comments

Comments

@tangdu
Copy link

tangdu commented Aug 23, 2018

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

@thesby
Copy link

thesby commented Nov 27, 2018

I met this problem too. How to solve it?

@LiUzHiAn
Copy link

LiUzHiAn commented Mar 30, 2019

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.

@greyli
Copy link
Contributor

greyli commented Apr 19, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants