Flask - AssertionError: The sqlalchemy extension was not registered to the current application. Please make sure to call init_app() first.解决方案

flask实现创建数据库表,处理The sqlalchemy extension was not registered to the current application报错的解决文案

1 # 模板命令三连
2 python manage.py db init   
3 python manage.py db migrate   
4 python manage.py db upgrade 

 

 

 

 

先到初始化app

所以,manager = Manager(app) 

前面加上一行代码db.init_app(app)

如下:

 

 

然后删除migrations文件,重新命令三连 ; OK 成功了!

 

posted @ 2020-11-25 15:43  FishMan552  阅读(1321)  评论(0编辑  收藏  举报