0

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 %}
squidg
  • 451
  • 6
  • 17

1 Answers1

0

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

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

pjosols
  • 86
  • 1
  • 2
  • The folder is templates/base.html, I also tried templates/bootstrap/base.html but I think this directory isn't needed as flask-bootstrap handles it so all templates should be inside the templates folder and then to use boostrap inside a template {% extends 'bootstrap/base.html' %} is used? – squidg May 20 '21 at 01:14
  • If the templates are in the template folder, did you try simply `{% extends 'base.html %} like in this demo? https://github.com/mbr/flask-bootstrap/blob/master/sample_app/templates/signup.html – pjosols May 20 '21 at 13:02