Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit 645adca

Browse files
committed
improvement: add var folder for log files
1 parent 51520c0 commit 645adca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

covid19/settings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,17 @@
150150
# 静态文件目录
151151
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
152152

153+
# 日志文件目录
154+
LOGS_DIR = os.path.join(BASE_DIR, 'var', 'logs')
155+
if not os.path.exists(LOGS_DIR):
156+
os.makedirs(LOGS_DIR)
157+
153158
# 配置 Scrapy 命令完整路径
154159
SCRAPY_CMD = '~/.virtualenvs/django-covid19/bin/scrapy'
155160

156161
# Setting of Crontab
157162
CRONJOBS = (
158163
# 每分钟抓取一次
159-
('*/1 * * * *', 'ncovapi.cron.crawl_dxy', [], {}, '>> %s/var/logs/crontab.log' % BASE_DIR),
164+
('*/1 * * * *', 'ncovapi.cron.crawl_dxy', [], {}, '>> %s/crontab.log' % LOGS_DIR),
160165
)
161166

0 commit comments

Comments
 (0)