jinja2.exceptions.TemplateNotFound: bootstrap/base.html
Asked Answered
C

4

11

I'm inheriting bootstrap/base.html in a Flask application after installing the Bootstrap Flask extension but having the below error:

jinja2.exceptions.TemplateNotFound: bootstrap/base.html
Cortezcortical answered 1/6, 2017 at 22:35 Comment(0)
S
21

You need to import Bootstrap in this way below:

from flask_bootstrap import Bootstrap
...
bootstrap = Bootstrap(app)

flask.ext.bootstrap is deprecated

Spicule answered 2/8, 2017 at 17:55 Comment(0)
L
2

The answer is correct.

You can test settings in the execution file, for example: flaskr/flaskr.py

from flask_bootstrap import Bootstrap
....
app = Flask(__name__)
bootstrap = Bootstrap(app)
db = SQLAlchemy(app)

The problem should have been solved.

Longe answered 16/2, 2018 at 16:30 Comment(0)
C
1

Need to import Bootstrap from flask.ext.bootstrap and bootstrap the flask app as below:

from flask.ext.bootstrap import Bootstrap
...
bootstrap = Bootstrap(app)
Cortezcortical answered 1/6, 2017 at 22:48 Comment(1)
By the time you posted the question, the import should be done as shown in the accepted answer, instead.Carbohydrate
C
1

If it's a full flask project, u need to do these:

from flask_bootstrap import Bootstrap
bootstrap = Bootstrap(app)

inside your __init__.py file

Conjurer answered 19/2, 2019 at 12:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.