简体   繁体   中英

Flask - jinja2.exceptions.TemplateNotFound

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 %}

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM