Flask - jinja2.exceptions.TemplateNotFound

955 Views Asked by At

I am following along with the Flask Mega Tutorial and I'm trying to use flask_bootstrap but keep getting the error jinja2.exceptions.TemplateNotFound: bootstrap/base.html.

In the app folder there is an init.py file were I initialize bootstrap

from flask_bootstrap import Bootstrap

app = Flask(__name__)
app.config.from_object(Config) 
db = SQLAlchemy(app) 
migrate = Migrate(app, db)
login = LoginManager(app)
login.login_view = 'login'
mail = Mail(app)
bootstrap = Bootstrap(app)

In that folder there is a template folder that contains base.html.

{% extends 'bootstrap/base.html' %}

{% block title %}
    {% if title %}{{ title }} - Microblog{% else %}{{ _('Welcome to Microblog') }}{% endif %}
{% endblock %}
1

There are 1 best solutions below

2
On

Make sure your templates are in a templates folder, like templates/bootstrap/base.html.

Or just templates/base.html then {% extends 'base.html' %}