Flask异常处理:UserWarning: Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. Defaulting SQLAL

Flask异常—— 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. ’
Flask异常——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 ’
在使用flask框架连接数据库时,可能会遇到如下异常:
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 ’
Insert picture description here

Solution:
Check if there is any problem with the package imported by Config. Pay attention to the capitalization and spelling of letters.
Insert picture description here
My wrong way of writing. The Config I used should not be the Config in the flask package, but the Config defined by
Insert picture description here
Insert picture description here
myself. I wrote the Config myself. Add it in, it can run normally
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_46277411/article/details/115279962