From 20cbbdb2e079e8b89dab9340f69a8d7e78db301a Mon Sep 17 00:00:00 2001 From: Reinout van Rees Date: Wed, 3 Apr 2024 20:00:23 +0200 Subject: [PATCH 1/3] Added allowed hosts (for production/staging only) --- brostar_api/settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brostar_api/settings.py b/brostar_api/settings.py index c6ee066..7ba31aa 100644 --- a/brostar_api/settings.py +++ b/brostar_api/settings.py @@ -30,6 +30,8 @@ ALLOWED_HOSTS = [] +if not DEBUG: + ALLOWED_HOSTS = [".brostar.nl"] CSRF_TRUSTED_ORIGINS = [ "http://localhost:4200", From 23fdd6b3a307f3dd4d49a5325316df5f69385f8f Mon Sep 17 00:00:00 2001 From: Reinout van Rees Date: Wed, 3 Apr 2024 20:07:53 +0200 Subject: [PATCH 2/3] Log to console --- brostar_api/settings.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/brostar_api/settings.py b/brostar_api/settings.py index 7ba31aa..0602409 100644 --- a/brostar_api/settings.py +++ b/brostar_api/settings.py @@ -98,18 +98,17 @@ LOGGING = { "version": 1, - "disable_existing_loggers": False, + "disable_existing_loggers": True, "handlers": { - "file": { + "console": { "level": "DEBUG", - "class": "logging.FileHandler", - "filename": os.path.join(BASE_DIR, "django_log.log"), + "class": "logging.StreamHandler", }, }, "loggers": { "": { - "handlers": ["file"], - "level": "DEBUG", + "handlers": ["console"], + "level": "DEBUG" if DEBUG else "INFO", "propagate": True, }, }, From 6baaf2338866a2ab35445a4165992e86683bbb03 Mon Sep 17 00:00:00 2001 From: Reinout van Rees Date: Wed, 3 Apr 2024 20:09:16 +0200 Subject: [PATCH 3/3] Don't log all the queries --- brostar_api/settings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/brostar_api/settings.py b/brostar_api/settings.py index 0602409..58adba4 100644 --- a/brostar_api/settings.py +++ b/brostar_api/settings.py @@ -111,6 +111,11 @@ "level": "DEBUG" if DEBUG else "INFO", "propagate": True, }, + "django": { + "handlers": ["console"], + "level": "INFO", # DEBUG level would also print sql statements + "propagate": False, + }, }, }