为什么使弃用警告静音不起作用?

问题描述

我试图消除 Flask-sqlAlchemy 关于增加开销的弃用警告(如果使用) 带有修改跟踪:

config.py 文件

class BaseConfig:
    DEBUG = False
    TESTING = False
    sqlALCHEMY_DATABASE_URI = ''
    sqlALCHEMY_TRACK_MODIFICATIONS = False

class TestingConfig(BaseConfig):
    TESTING = True

测试文件

from flask_testing import TestCase
from project.config import TestingConfig
from project.models import User
from project import create_app
from project import db
import unittest

app = create_app()

class Testdbsetup(TestCase):

    def create_app(self):
        app.config.from_object(TestingConfig)
        return app

    def setUp(self):
        db.create_all()

    def tearDown(self):
        db.session.remove()
        db.drop_all()

if __name__ == '__main__':
    unittest.main()

我仍然得到著名的 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.

我怎样才能正确地让它静音?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)