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

Commit f84481a

Browse files
committed
Merge branch 'develop'
2 parents 9426598 + 17a9094 commit f84481a

File tree

13 files changed

+95
-50
lines changed

13 files changed

+95
-50
lines changed

demo_proj/ncov/settings.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@
186186
# 每分钟抓取丁香园数据一次
187187
('*/1 * * * *', 'django.core.management.call_command', ['crawl', 'dxy']),
188188

189-
# 每小时0分时开始抓取 covidtracking 数据一次
190-
('0 * * * *', 'django.core.management.call_command', ['crawl', 'covidtracking'])
189+
# 每隔1小时开始抓取 covidtracking 数据一次
190+
('*/60 * * * *', 'django.core.management.call_command', ['crawl', 'covidtracking']),
191191
)
192+
193+
# scrapy 日志文件路径
194+
SCRAPY_LOG_FILE = '/var/tmp/django-covid19-spider.log'

demo_proj/requirements.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
attrs==19.3.0
2+
Automat==20.2.0
3+
cffi==1.14.0
4+
constantly==15.1.0
5+
cryptography==2.9.2
6+
cssselect==1.1.0
7+
Django==2.2.13
8+
django-cors-headers==3.3.0
9+
django-covid19
10+
django-crontab==0.7.1
11+
django-filter==2.2.0
12+
django-mysql==3.5.0
13+
djangorestframework==3.11.0
14+
hyperlink==19.0.0
15+
idna==2.9
16+
incremental==17.5.0
17+
lxml==4.5.1
18+
parsel==1.6.0
19+
Protego==0.1.16
20+
pyasn1==0.4.8
21+
pyasn1-modules==0.2.8
22+
pycparser==2.20
23+
PyDispatcher==2.0.5
24+
PyHamcrest==2.0.2
25+
pyOpenSSL==19.1.0
26+
pytz==2020.1
27+
queuelib==1.5.0
28+
Scrapy==2.0.1
29+
scrapy-djangoitem==1.1.1
30+
service-identity==18.1.0
31+
six==1.15.0
32+
sqlparse==0.3.1
33+
Twisted==20.3.0
34+
w3lib==1.22.0
35+
zope.interface==5.1.0

django_covid19/admin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CityAdmin(BaseAdmin):
6363
list_display = (
6464
'countryCode', 'provinceName', 'provinceCode', 'cityName',
6565
'currentConfirmedCount', 'confirmedCount', 'suspectedCount',
66-
'curedCount', 'deadCount'
66+
'curedCount', 'deadCount', 'createTime', 'modifyTime'
6767
)
6868
search_fields = (
6969
'cityName', 'countryCode', 'provinceCode', 'provinceName'
@@ -76,7 +76,7 @@ class ProvinceAdmin(BaseAdmin):
7676
list_display = (
7777
'countryCode', 'provinceName',
7878
'currentConfirmedCount', 'confirmedCount', 'suspectedCount',
79-
'curedCount', 'deadCount'
79+
'curedCount', 'deadCount', 'createTime', 'modifyTime'
8080
)
8181
search_fields = ('provinceName', 'countryCode')
8282

@@ -86,8 +86,8 @@ class CountryAdmin(BaseAdmin):
8686

8787
list_display = (
8888
'continents', 'countryCode', 'countryName', 'countryFullName',
89-
'currentConfirmedCount', 'confirmedCount',
90-
'suspectedCount', 'curedCount', 'deadCount'
89+
'currentConfirmedCount', 'confirmedCount', 'suspectedCount',
90+
'curedCount', 'deadCount', 'createTime', 'modifyTime'
9191
)
9292
search_fields = (
9393
'continents', 'countryFullName', 'countryCode', 'countryName'

django_covid19/fixtures/city.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

django_covid19/fixtures/country.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

django_covid19/fixtures/province.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

django_covid19/fixtures/statistics.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

django_covid19/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Country(models.Model):
4646
curedCount = models.IntegerField(default=0)
4747
deadCount = models.IntegerField(default=0)
4848

49-
showRank = models.BooleanField(null=True)
49+
showRank = models.BooleanField(default=False)
5050
deadRateRank = models.IntegerField(null=True)
5151
deadCountRank = models.IntegerField(null=True)
5252
confirmedCountRank = models.FloatField(null=True)

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)