From 7640acf3f460a75af65db6d09297e2ec57e62dd5 Mon Sep 17 00:00:00 2001 From: liangliangyy Date: Mon, 20 Jun 2022 16:21:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=BA=E6=97=A5=E5=BF=97=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A2=9E=E5=8A=A0=E6=97=A5=E6=9C=9F=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- djangoblog/settings.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/djangoblog/settings.py b/djangoblog/settings.py index 6df8a9c99..eae379c99 100644 --- a/djangoblog/settings.py +++ b/djangoblog/settings.py @@ -218,6 +218,10 @@ def env_to_bool(env, default): WXADMIN = os.environ.get( 'DJANGO_WXADMIN_PASSWORD') or '995F03AC401D6CABABAEF756FC4D43C7' +LOG_PATH = os.path.join(BASE_DIR, 'logs') +if not os.path.exists(LOG_PATH): + os.makedirs(LOG_PATH, exist_ok=True) + LOGGING = { 'version': 1, 'disable_existing_loggers': False, @@ -241,10 +245,14 @@ def env_to_bool(env, default): 'handlers': { 'log_file': { 'level': 'INFO', - 'class': 'logging.handlers.RotatingFileHandler', - 'filename': 'djangoblog.log', - 'maxBytes': 16777216, # 16 MB - 'formatter': 'verbose' + 'class': 'logging.handlers.TimedRotatingFileHandler', + 'filename': os.path.join(LOG_PATH, 'djangoblog.log'), + 'when': 'D', + 'formatter': 'verbose', + 'interval': 1, + 'delay': True, + 'backupCount': 5, + 'encoding': 'utf-8' }, 'console': { 'level': 'DEBUG', From 019695a5ebe350ea24f0517c0ff2c3ae2bc44e7c Mon Sep 17 00:00:00 2001 From: liangliangyy Date: Mon, 20 Jun 2022 16:24:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 73932b7ef..780a72492 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ coverage==6.4 bleach==5.0.0 -Django==4.0.4 +Django==4.0.5 django-compressor==4.0 django-haystack==3.2.1 django-ipware==4.0.2 @@ -19,9 +19,9 @@ python-logstash==0.4.6 python-slugify==6.1.2 pytz==2022.1 raven==6.10.0 -requests==2.27.1 +requests==2.28.0 urllib3==1.26.9 WeRoBot==1.13.1 Whoosh==2.7.4 user-agents==2.2.0 -redis==4.3.1 +redis==4.3.3