From ed0d0af27bbb37daad25b70b8ea9368ed0218c24 Mon Sep 17 00:00:00 2001 From: Amaury Carrade Date: Thu, 8 Apr 2021 12:12:53 +0200 Subject: [PATCH] Added logs into Django for prod --- hawk/settings/prod.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hawk/settings/prod.py b/hawk/settings/prod.py index 8809061..eb91707 100644 --- a/hawk/settings/prod.py +++ b/hawk/settings/prod.py @@ -19,6 +19,7 @@ SECRET_KEY = config["secret_key"] CONTENTS_DIR = Path(config.get("contents_dir", BASE_DIR / ".." / "hawk-data")) +LOGS_DIR = Path(config.get("logs_dir", CONTENTS_DIR / "logs")) DATABASES = { "default": { @@ -41,6 +42,22 @@ pymysql.version_info = (2, 0, 3, "final", 0) pymysql.install_as_MySQLdb() +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'file': { + 'level': 'DEBUG', + 'class': 'logging.FileHandler', + 'filename': LOGS_DIR / "django.log", + }, + }, + 'root': { + 'handlers': ['file'], + 'level': 'DEBUG', + }, +} + STATIC_ROOT = CONTENTS_DIR / "static" MEDIA_ROOT = CONTENTS_DIR / "user-generated-content" MAINTENANCE_MODE_STATE_FILE_PATH = CONTENTS_DIR / "maintenance"