Enable deprecation warnings in dev environment (including SQLAlchemy 2.0 warnings)

This commit is contained in:
Lexi / Zoe 2022-04-15 01:50:27 +02:00
parent 04d434b4a3
commit 4b9d973f40
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,6 @@
FLASK_APP=tofu_api.app
FLASK_ENV=development
FLASK_CONFIG_FILE=config.dev.yml
# Show SQLAlchemy 2.0 deprecation warnings
SQLALCHEMY_WARN_20=1

View File

@ -1,4 +1,6 @@
import os
import sys
import warnings
from flask import Flask
@ -6,6 +8,10 @@ from tofu_api.api import TofuApiBlueprint
from tofu_api.common.config import Config
from tofu_api.dependencies import Dependencies
# Enable deprecation warnings in dev environment
if not sys.warnoptions and os.getenv('FLASK_ENV') == 'development':
warnings.filterwarnings('default', module='tofu_api.*')
class App(Flask):
"""