修复日志和 media 文件bug

pull/2/head
李强 2021-03-18 22:53:56 +08:00
parent 0aae70f319
commit 6a3e3c68cf
1 changed files with 7 additions and 1 deletions

View File

@ -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',
},
# 数据库相关日志