使用Flask和Flask-Admin时如何解决“ register_blueprint”错误?

时间:2019-07-13 14:09:51

标签: python flask flask-admin

我用Celery,登录管理器等设置我的应用程序没有问题,但是Flask-Admin正在中断...

from flask_admin import Admin

admin = Admin(name='myapp')

def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config['dev'])
    config['dev'].init_app(app)
    ...
    admin.init_app(admin)
    ...
    return app

当我尝试运行Flask时,在没有注册任何蓝图之前,我会收到以下错误消息...

  File "c:\mtrapp\venv\lib\site-packages\flask_admin\base.py", line 697, in init_app
    app.register_blueprint(view.create_blueprint(self))
AttributeError: 'Admin' object has no attribute 'register_blueprint'

我在哪里做错了?谢谢!

0 个答案:

没有答案