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

Commit 1924d81

Browse files
committed
feat: update settings.py from demo_proj
1 parent c708a3e commit 1924d81

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

demo_proj/ncov/settings.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138

139139
CACHES = {
140140
'default': {
141-
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
141+
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
142142
'LOCATION': '/var/tmp/ncov_cache',
143143
'TIMEOUT': 3600,
144144
'OPTIONS': {
@@ -147,8 +147,9 @@
147147
}
148148
}
149149

150-
if DEBUG == False:
151-
CACHES['default']['BACKEND'] = 'django.core.cache.backends.filebased.FileBasedCache'
150+
if DEBUG == True:
151+
CACHES['default']['BACKEND'] = 'django.core.cache.backends.locmem.LocMemCache'
152+
CACHES['default']['LOCATION'] = 'ncov'
152153

153154
# 跨域增加忽略
154155
CORS_ALLOW_CREDENTIALS = True
@@ -183,7 +184,10 @@
183184

184185
CRONTAB_LOCK_JOBS = True
185186
CRONJOBS = (
186-
# 每分钟抓取一次
187-
('*/1 * * * *', 'django.core.management.call_command', ['crawl']),
187+
# 每分钟抓取丁香园数据一次
188+
('*/1 * * * *', 'django.core.management.call_command', ['crawl', 'dxy']),
189+
190+
# 下午4点到6点间每10分钟抓取 covidtracking 数据一次
191+
('*/10 16-18 * * *', 'django.core.management.call_command', ['crawl', 'covidtracking'])
188192
)
189193

0 commit comments

Comments
 (0)