1

这是我的第一篇文章,如有错误请见谅...

我正在构建一个 Flask 应用程序并使用 Flask Bootstrap,但我无法找出为什么会出现此错误,因为此方法属于 flask-bootstrap 包的 base.html 模板。

文件“c:\users\diego\documents\repositorios\simpleiotserver\venv\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html”,第 15 行,在“样式”块中

jinja2.exceptions.UndefinedError: 'bootstrap_find_resource' 未定义

似乎一切都按原样完成了,我自己找不到错误。

这是代码...

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
4

3 回答 3

2

这个问题发生在我身上,因为我安装了两个库bootstrap-flaskflask_bootstrap我卸载flask_bootstrap 然后卸载flask_bootstrap然后flask_bootstrap再次安装,那工作。

于 2020-11-17T06:10:59.777 回答
1

我有同样的问题,我所做的是pip uninstall flask_bootstrap删除烧瓶引导程序并重新安装pip install flask_bootstrap. 它对我有用。有时会出现这些问题,因为操作系统可能会删除一些文件或用户操作可能会删除一些文件。

于 2019-05-23T23:07:30.547 回答
0

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

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

于 2018-11-13T16:11:07.787 回答