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:
parent
19ce49cc55
commit
2b6d94c766
3 changed files with 2 additions and 3 deletions
|
@ -3,4 +3,4 @@ from . import create_app
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run()
|
|
@ -9,7 +9,7 @@ def quote(value: str) -> str:
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
DEBUG = True
|
DEBUG = os.getenv('DEBUG', 'false').strip().lower() in ['true', '1', 'yes']
|
||||||
TESTING = False
|
TESTING = False
|
||||||
|
|
||||||
DB_BACKEND = os.getenv('DB_BACKEND', 'sqlite').lower()
|
DB_BACKEND = os.getenv('DB_BACKEND', 'sqlite').lower()
|
||||||
|
|
|
@ -6,7 +6,6 @@ from . import main
|
||||||
|
|
||||||
@main.after_request
|
@main.after_request
|
||||||
def prettify_or_minify_html_response(response):
|
def prettify_or_minify_html_response(response):
|
||||||
print(app.debug, response.content_type)
|
|
||||||
if response.content_type.startswith("text/html"):
|
if response.content_type.startswith("text/html"):
|
||||||
try:
|
try:
|
||||||
html = response.get_data(as_text=True)
|
html = response.get_data(as_text=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue