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 成功了!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM