Ram*_*mar -1 python flask flask-sqlalchemy
我在烧瓶程序中遇到了上述错误。我正在使用 Flask-SQLALCHEMY - 2.4.1 和 Pycharm 编辑器。请帮助解决这个问题。我在这上面浪费了很多时间。
UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.
warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.')
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
Run Code Online (Sandbox Code Playgroud)
您需要的行是:
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
Run Code Online (Sandbox Code Playgroud)
把它放在 SQLAlchemy() 调用之前。您可以更改app
对应的 Flask 对象名称。