Refactor config to set DEBUG based on environment variable for better configuration management.

Remove debug print statement from hooks to clean up response handling.
This commit is contained in:
Yaro Kasear 2025-07-24 16:00:13 -05:00
parent 19ce49cc55
commit 2b6d94c766
3 changed files with 2 additions and 3 deletions

View file

@ -3,4 +3,4 @@ from . import create_app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
app.run()

View file

@ -9,7 +9,7 @@ def quote(value: str) -> str:
class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = True
DEBUG = os.getenv('DEBUG', 'false').strip().lower() in ['true', '1', 'yes']
TESTING = False
DB_BACKEND = os.getenv('DB_BACKEND', 'sqlite').lower()

View file

@ -6,7 +6,6 @@ from . import main
@main.after_request
def prettify_or_minify_html_response(response):
print(app.debug, response.content_type)
if response.content_type.startswith("text/html"):
try:
html = response.get_data(as_text=True)