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

Commit 122fdfe

Browse files
committed
improvement: update scrapy settings in django's settings.py
1 parent e4217df commit 122fdfe

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

django_covid19/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from django.conf import settings
22

3-
CACHE_PAGE_TIMEOUT = getattr(settings, 'CACHE_PAGE_TIMEOUT', 24*60*60)
3+
CACHE_PAGE_TIMEOUT = getattr(settings, 'CACHE_PAGE_TIMEOUT', 24*60*60)
4+
5+
SCRAPY_LOG_FILE = getattr(settings, 'SCRAPY_LOG_FILE', None)

django_covid19/spider/nCoV/settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,12 @@
8989
#HTTPCACHE_DIR = 'httpcache'
9090
#HTTPCACHE_IGNORE_HTTP_CODES = []
9191
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
92+
93+
# Get settings from django
94+
from django.conf import settings
95+
96+
for name in dir(settings):
97+
if not name.startswith('SCRAPY_'):
98+
continue
99+
scrapy_name = name[7:]
100+
globals()[scrapy_name] = getattr(settings, name, None)

0 commit comments

Comments
 (0)