From a6d9e828195583265c4fa3e65600c325c543ecba Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 8 Aug 2019 21:28:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=BD=D1=83=D1=8E=20=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=B8=D1=8E=20=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D1=8B=20=D0=9B=D0=BE=D0=B3=D0=B8=D0=BD=20/=20?= =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/settings.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/project/settings.py b/project/settings.py index 817c2938..3218b5a2 100644 --- a/project/settings.py +++ b/project/settings.py @@ -197,13 +197,10 @@ LOGGING = { 'formatter': 'verbose', }, 'log_file': { - 'level': 'INFO', - 'class': 'logging.handlers.RotatingFileHandler', - 'filename': 'media/logs/main.log', - 'maxBytes': 1024 * 1024 * 5, # 5 MB - 'backupCount': 7, + 'level': 'DEBUG', + 'filters': ['require_debug_true'], + 'class': 'logging.StreamHandler', 'formatter': 'verbose', - 'filters': ['require_debug_false'], }, }, 'loggers': { @@ -225,6 +222,17 @@ LOGGING = { } } +if os.path.exists(os.path.join(BASE_DIR, '/media/logs')): + LOGGING['handlers']['log_file'] = { + 'level': 'INFO', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': 'media/logs/main.log', + 'maxBytes': 1024 * 1024 * 15, # 5 MB + 'backupCount': 7, + 'formatter': 'verbose', + 'filters': ['require_debug_false'], + } + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/