SQLALCHEMY_DATABASE_URI not set

我的未来我决定 提交于 2019-11-30 18:03:24

You probably need to put this line app.config['SQLALCHEMY_DATABASE_URI'] = "mysql..." before the SQLAlchemy(app) instanciation.

Another option is to create SQLAlchemy() without parametters, to configure URI, and finally to tell SQLAlchemy to link with your app via sqldb.init_app(app)

Note that it is what you've done in your create_app function, but you never use it ?

huangke

Like the answer above, if you use it this way, change

sqldb = SQLAlchemy(app)

to

sqldb = SQLAlchemy()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!