From 6a3e3c68cfc0ceee95bbbccdb840746b072d4605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BC=BA?= <1206709430@qq.com> Date: Thu, 18 Mar 2021 22:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97=E5=92=8C?= =?UTF-8?q?=20media=20=E6=96=87=E4=BB=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dvadmin-backend/application/settings.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dvadmin-backend/application/settings.py b/dvadmin-backend/application/settings.py index 794252f..e1b13ae 100644 --- a/dvadmin-backend/application/settings.py +++ b/dvadmin-backend/application/settings.py @@ -134,6 +134,8 @@ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] +if not os.path.exists(os.path.join(BASE_DIR, 'media')): + os.makedirs(os.path.join(BASE_DIR, 'media')) # 访问上传文件的url地址前缀 MEDIA_URL = "/media/" # 项目中存储上传文件的根目录 @@ -164,6 +166,10 @@ LOGGING = { 'format': CONSOLE_LOG_FORMAT, 'datefmt': '%Y-%m-%d %H:%M:%S', }, + 'file': { + 'format': CONSOLE_LOG_FORMAT, + 'datefmt': '%Y-%m-%d %H:%M:%S', + }, }, 'handlers': { 'file': { @@ -193,7 +199,7 @@ LOGGING = { 'loggers': { # default日志 '': { - 'handlers': ['console'], + 'handlers': ['console','error','file'], 'level': 'INFO', }, # 数据库相关日志