Diego Medeiros
Diego Medeiros

Reputation: 575

jinja2.exceptions.UndefinedError: 'bootstrap_find_resource' is undefined

This is my very first post, so excuse me for any mistakes...

I'm building a Flask App and using Flask Bootstrap, but I can't find out why I'm getting this error since this method belongs to the base.html template of the flask-bootstrap package.

File "c:\users\diego\documents\repositorios\simpleiotserver\venv\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 15, in block "styles"

jinja2.exceptions.UndefinedError: 'bootstrap_find_resource' is undefined

Seems like everything was done as it should and I can't find the mistake by myself.

Here's the code...

from flask_bootstrap import Bootstrap
from config import config

bootstrap = Bootstrap()


def create_app(config_name):
    app = Flask(__name__)
    bootstrap.init_app(app)

    from .main import main as main_blueprint
    app.register_blueprint(main_blueprint)

    from .api_v1 import api_v1 as api_v1_blueprint
    app.register_blueprint(api_v1_blueprint)

    return app

Upvotes: 2

Views: 5518

Answers (4)

Denis
Denis

Reputation: 21

To solve a similar issue I had, I run the following commands on my main Terminal not on my editor Terminal. $pip uninstall flask_bootstrap to uninstall the flask_bootstrap I had then $pip install flask_bootstrap to reinstall it back. And sometimes after doing the installations and the problem persists, you just need to restart your editor.

Upvotes: 0

henrry
henrry

Reputation: 623

This problem occurred for me because i installed two library bootstrap-flask and flask_bootstrap, I uninstall flask_bootstrap and then uninstall flask_bootstrap then install flask_bootstrap again, that work.

Upvotes: 3

Boogie
Boogie

Reputation: 360

I had the same issue and what i did was pip uninstall flask_bootstrap to remove flask bootstrap and reinstalled with pip install flask_bootstrap. It worked for me. Sometime these issues occur since the Operating system may delete some files or a user operation may delete some files.

Upvotes: 1

Diego Medeiros
Diego Medeiros

Reputation: 575

I've created another virtual environment and checked on the Flask instance configurations.

Probably some package was missing. It all works fine now.

Upvotes: 1

Related Questions