当Flask-SqlAlchemy导入出错时的解决办法(VSCode)

Galina ·
更新时间:2024-09-21
· 600 次阅读

如图,安装了Flask_SqlAlchemy的时候出错:

C:\ProgramData\Anaconda3\lib\site-packages\flask_sqlalchemy\__initad and will be disable__.py:835: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS ahis warning.dds 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 '

经查询以后,直接打开这个__init__.py对应的第835行(不同版本的行数可能不同,反正按照这个提示找对应的行数就对了),修改一下配置文件:

原本的语句是"if track_modifications is None:"把"None"替换成"True"或者"False",再保存即可。可能直接保存不上,需要用管理员身份Save。

再运行就没有报错了。


作者:MaineCoon



vscode flask sqlalchemy

需要 登录 后方可回复, 如果你还没有账号请 注册新账号