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

+5-2
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

+35
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

+4-4
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

+1-1
Large diffs are not rendered by default.

django_covid19/fixtures/country.json

+1-1
Large diffs are not rendered by default.

django_covid19/fixtures/province.json

+1-1
Large diffs are not rendered by default.

django_covid19/fixtures/statistics.json

+1-1
Large diffs are not rendered by default.

django_covid19/models.py

+1-1
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

+3-1
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

+9
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)

requirements.txt

+1-34
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,6 @@
1-
attrs==19.3.0
2-
Automat==20.2.0
3-
certifi==2020.4.5.1
4-
cffi==1.14.0
5-
chardet==3.0.4
6-
constantly==15.1.0
7-
cryptography==2.9
8-
cssselect==1.1.0
9-
Django==2.2.13
10-
django-cors-headers==3.2.1
111
django-crontab==0.7.1
122
django-filter==2.2.0
13-
django-mysql==3.4.0
143
djangorestframework==3.11.0
15-
drf-extensions==0.6.0
16-
hyperlink==19.0.0
17-
idna==2.9
18-
incremental==17.5.0
19-
lxml==4.5.0
20-
parsel==1.5.2
21-
Protego==0.1.16
22-
pyasn1==0.4.8
23-
pyasn1-modules==0.2.8
24-
pycparser==2.20
25-
PyDispatcher==2.0.5
26-
PyHamcrest==2.0.2
27-
pyOpenSSL==19.1.0
28-
pytz==2019.3
29-
queuelib==1.5.0
30-
schedule==0.6.0
314
Scrapy==2.0.1
325
scrapy-djangoitem==1.1.1
33-
service-identity==18.1.0
34-
six==1.14.0
35-
sqlparse==0.3.1
36-
Twisted==20.3.0
37-
urllib3==1.25.9
38-
w3lib==1.21.0
39-
zope.interface==5.1.0
6+
django-mysql==3.5.0

setup.cfg

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
[metadata]
22
name = django_covid19
3-
version = 0.4b1
4-
description = An django app of the covid-19 API in countries around the world, provinces and cities in China, and states in the USA.
3+
version = 0.4rc1
4+
description = A django app of covid-19 API in countries around the world, provinces and cities in China, and states in the USA.
55
long_description = file: README.md
66
long-description-content-type = text/markdown
77
url = https://github.com/leafcoder/django-covid19
88
author = leafcoder
99
author_email = [email protected]
1010
license = MIT
11+
license_file = LICENSE
1112
keywords = python django covid19 2019-ncov app
1213
classifiers =
14+
Development Status :: 5 - Production/Stable
1315
Environment :: Web Environment
1416
Framework :: Django
17+
Framework :: Django :: 2.0
18+
Framework :: Django :: 2.1
1519
Framework :: Django :: 2.2
16-
Framework :: Django :: 3.0
1720
Intended Audience :: Developers
1821
License :: OSI Approved :: MIT License
22+
Natural Language :: Chinese (Simplified)
1923
Operating System :: OS Independent
2024
Programming Language :: Python
2125
Programming Language :: Python :: 3
2226
Programming Language :: Python :: 3 :: Only
27+
Programming Language :: Python :: 3.5
2328
Programming Language :: Python :: 3.6
2429
Programming Language :: Python :: 3.7
25-
Programming Language :: Python :: 3.8
2630
Topic :: Internet :: WWW/HTTP
2731
Topic :: Internet :: WWW/HTTP :: Dynamic Content
32+
Topic :: Software Development :: Libraries
33+
Topic :: Software Development :: Libraries :: Python Modules
2834

2935
[options]
3036
include_package_data = true

tox.ini

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tox]
2+
envlist =
3+
py{35,36,37}-django{20,21,22}
4+
5+
[testenv]
6+
deps=
7+
django20: Django>=2.0,<2.1
8+
django21: Django>=2.1,<2.2
9+
django22: Django>=2.2,<2.3
10+
django_mysql
11+
django-cors-headers
12+
django-crontab
13+
django-filter
14+
djangorestframework
15+
Scrapy
16+
scrapy-djangoitem
17+
setenv=
18+
PYTHONDONTWRITEBYTECODE=1
19+
changedir=
20+
demo_proj
21+
commands=
22+
{envpython} manage.py test django_covid19
23+
sitepackages=False

0 commit comments

Comments
 (0)