Python 烧瓶-蓝图';发生了名称冲突

Python 烧瓶-蓝图';发生了名称冲突,python,python-2.7,flask,flask-bootstrap,Python,Python 2.7,Flask,Flask Bootstrap,我遇到了一个问题。控制台说blueprint的名称发生冲突,但我认为这不是SRAP问题。我相信我有一些配置或未知的东西,它让我遇到了问题 Traceback (most recent call last): File "manage.py", line 10, in <module> app = create_app() File "D:\TONY\GitHub\private-home-flask-cuisine\db-example\app\__init__.py

我遇到了一个问题。控制台说blueprint的名称发生冲突,但我认为这不是SRAP问题。我相信我有一些配置或未知的东西,它让我遇到了问题

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    app = create_app()
  File "D:\TONY\GitHub\private-home-flask-cuisine\db-example\app\__init__.py", line 79, in create_app
    init_extensions(app)
  File "D:\TONY\GitHub\private-home-flask-cuisine\db-example\app\__init__.py", line 46, in init_extensions
    extension.init_app(app=app)
  File "D:\TONY\GitHub\private-home-flask-cuisine\db-example\env\lib\site-packages\flask_bootstrap\__init__.py", line 137, in init_app
    app.register_blueprint(blueprint)
  File "D:\TONY\GitHub\private-home-flask-cuisine\db-example\env\lib\site-packages\flask\app.py", line 62, in wrapper_func
    return f(self, *args, **kwargs)
  File "D:\TONY\GitHub\private-home-flask-cuisine\db-example\env\lib\site-packages\flask\app.py", line 885, in register_blueprint
    (blueprint, self.blueprints[blueprint.name], blueprint.name)
AssertionError: A blueprint's name collision occurred between <flask.blueprints.Blueprint object at 0x034EA230> and <flask.blueprints.Blueprint object at 0x0349
7770>.  Both share the same name "bootstrap".  Blueprints that are created on the fly need unique names.

或者任何人都可以告诉我如何在应用程序中查找blueprint对象,并让我跟踪bug。谢谢。

看起来您的应用程序正在两次注册引导蓝图。引导程序的源代码中有一行代码在
init\u app()

请尝试从此处删除它:

    ...
    bootstrap,
    db,
    ma,  # Warning: Flask-SQLAlchemy must be initialized before Flask-Marshmallow.
    login_manager,
或者从这个元组:

# Blueprint List: Wrap up the all blueprints
    buleprints = (
        dict(blueprint=users.users_bp, url_prefix='/users'),

        dict(blueprint=web_bp, url_prefix=''),
    )

是否有其他模块导入此脚本?@MartijnPieters在执行创建应用程序功能之前,我没有导入任何模块。
# Blueprint List: Wrap up the all blueprints
    buleprints = (
        dict(blueprint=users.users_bp, url_prefix='/users'),

        dict(blueprint=web_bp, url_prefix=''),
    )