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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
leafcoder committed Jun 9, 2020
2 parents 9426598 + 17a9094 commit f84481a
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 50 deletions.
7 changes: 5 additions & 2 deletions demo_proj/ncov/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@
# 每分钟抓取丁香园数据一次
('*/1 * * * *', 'django.core.management.call_command', ['crawl', 'dxy']),

# 每小时0分时开始抓取 covidtracking 数据一次
('0 * * * *', 'django.core.management.call_command', ['crawl', 'covidtracking'])
# 每隔1小时开始抓取 covidtracking 数据一次
('*/60 * * * *', 'django.core.management.call_command', ['crawl', 'covidtracking']),
)

# scrapy 日志文件路径
SCRAPY_LOG_FILE = '/var/tmp/django-covid19-spider.log'
35 changes: 35 additions & 0 deletions demo_proj/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
attrs==19.3.0
Automat==20.2.0
cffi==1.14.0
constantly==15.1.0
cryptography==2.9.2
cssselect==1.1.0
Django==2.2.13
django-cors-headers==3.3.0
django-covid19
django-crontab==0.7.1
django-filter==2.2.0
django-mysql==3.5.0
djangorestframework==3.11.0
hyperlink==19.0.0
idna==2.9
incremental==17.5.0
lxml==4.5.1
parsel==1.6.0
Protego==0.1.16
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyDispatcher==2.0.5
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pytz==2020.1
queuelib==1.5.0
Scrapy==2.0.1
scrapy-djangoitem==1.1.1
service-identity==18.1.0
six==1.15.0
sqlparse==0.3.1
Twisted==20.3.0
w3lib==1.22.0
zope.interface==5.1.0
8 changes: 4 additions & 4 deletions django_covid19/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CityAdmin(BaseAdmin):
list_display = (
'countryCode', 'provinceName', 'provinceCode', 'cityName',
'currentConfirmedCount', 'confirmedCount', 'suspectedCount',
'curedCount', 'deadCount'
'curedCount', 'deadCount', 'createTime', 'modifyTime'
)
search_fields = (
'cityName', 'countryCode', 'provinceCode', 'provinceName'
Expand All @@ -76,7 +76,7 @@ class ProvinceAdmin(BaseAdmin):
list_display = (
'countryCode', 'provinceName',
'currentConfirmedCount', 'confirmedCount', 'suspectedCount',
'curedCount', 'deadCount'
'curedCount', 'deadCount', 'createTime', 'modifyTime'
)
search_fields = ('provinceName', 'countryCode')

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

list_display = (
'continents', 'countryCode', 'countryName', 'countryFullName',
'currentConfirmedCount', 'confirmedCount',
'suspectedCount', 'curedCount', 'deadCount'
'currentConfirmedCount', 'confirmedCount', 'suspectedCount',
'curedCount', 'deadCount', 'createTime', 'modifyTime'
)
search_fields = (
'continents', 'countryFullName', 'countryCode', 'countryName'
Expand Down
2 changes: 1 addition & 1 deletion django_covid19/fixtures/city.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion django_covid19/fixtures/country.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion django_covid19/fixtures/province.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion django_covid19/fixtures/statistics.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion django_covid19/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Country(models.Model):
curedCount = models.IntegerField(default=0)
deadCount = models.IntegerField(default=0)

showRank = models.BooleanField(null=True)
showRank = models.BooleanField(default=False)
deadRateRank = models.IntegerField(null=True)
deadCountRank = models.IntegerField(null=True)
confirmedCountRank = models.FloatField(null=True)
Expand Down
4 changes: 3 additions & 1 deletion django_covid19/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.conf import settings

CACHE_PAGE_TIMEOUT = getattr(settings, 'CACHE_PAGE_TIMEOUT', 24*60*60)
CACHE_PAGE_TIMEOUT = getattr(settings, 'CACHE_PAGE_TIMEOUT', 24*60*60)

SCRAPY_LOG_FILE = getattr(settings, 'SCRAPY_LOG_FILE', None)
9 changes: 9 additions & 0 deletions django_covid19/spider/nCoV/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,12 @@
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'

# Get settings from django
from django.conf import settings

for name in dir(settings):
if not name.startswith('SCRAPY_'):
continue
scrapy_name = name[7:]
globals()[scrapy_name] = getattr(settings, name, None)
35 changes: 1 addition & 34 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
attrs==19.3.0
Automat==20.2.0
certifi==2020.4.5.1
cffi==1.14.0
chardet==3.0.4
constantly==15.1.0
cryptography==2.9
cssselect==1.1.0
Django==2.2.13
django-cors-headers==3.2.1
django-crontab==0.7.1
django-filter==2.2.0
django-mysql==3.4.0
djangorestframework==3.11.0
drf-extensions==0.6.0
hyperlink==19.0.0
idna==2.9
incremental==17.5.0
lxml==4.5.0
parsel==1.5.2
Protego==0.1.16
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyDispatcher==2.0.5
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pytz==2019.3
queuelib==1.5.0
schedule==0.6.0
Scrapy==2.0.1
scrapy-djangoitem==1.1.1
service-identity==18.1.0
six==1.14.0
sqlparse==0.3.1
Twisted==20.3.0
urllib3==1.25.9
w3lib==1.21.0
zope.interface==5.1.0
django-mysql==3.5.0
14 changes: 10 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
[metadata]
name = django_covid19
version = 0.4b1
description = An django app of the covid-19 API in countries around the world, provinces and cities in China, and states in the USA.
version = 0.4rc1
description = A django app of covid-19 API in countries around the world, provinces and cities in China, and states in the USA.
long_description = file: README.md
long-description-content-type = text/markdown
url = https://github.com/leafcoder/django-covid19
author = leafcoder
author_email = leafcoder@gmail.com
license = MIT
license_file = LICENSE
keywords = python django covid19 2019-ncov app
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 2.0
Framework :: Django :: 2.1
Framework :: Django :: 2.2
Framework :: Django :: 3.0
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Natural Language :: Chinese (Simplified)
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules

[options]
include_package_data = true
Expand Down
23 changes: 23 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tox]
envlist =
py{35,36,37}-django{20,21,22}

[testenv]
deps=
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
django_mysql
django-cors-headers
django-crontab
django-filter
djangorestframework
Scrapy
scrapy-djangoitem
setenv=
PYTHONDONTWRITEBYTECODE=1
changedir=
demo_proj
commands=
{envpython} manage.py test django_covid19
sitepackages=False

0 comments on commit f84481a

Please sign in to comment.