运行程序时出现错误:
UserWarning: Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. Defaulting SQLALCHEMY_DATABASE_URI to "sqlite:///:memory:".
'Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. '
FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
这个问题的原因在于,sqlalchemy的配置信息SQLALCHEMY_DATABASE_URI 和SQLALCHEMY_TRACK_MODIFICATIONS
也被抽了出去,所以在调用db.init_app()方法前应该先调用配置文件。
【解决】 app.config.from_object()先执行,然后再执行db.init_app()方法。
转自:使用SQLALCHEMY 出现warning的问题解决 - 编程361 - 博客园 (cnblogs.com)
标签:MODIFICATIONS,SQLALCHEMY,DATABASE,app,URI,warning,解决 From: https://www.cnblogs.com/gdbd/p/17267236.html