mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-24 20:33:04 +00:00
chore: Upgrade to Python 3 and update Django to 2.0
This commit is contained in:
parent
546038a831
commit
3d64938a3f
5 changed files with 19 additions and 21 deletions
|
@ -20,7 +20,7 @@ BASE_URL = 'http://pokeapi.co'
|
|||
|
||||
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
||||
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost']
|
||||
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost', '127.0.0.1']
|
||||
|
||||
TIME_ZONE = 'Europe/London'
|
||||
|
||||
|
@ -52,7 +52,6 @@ MIDDLEWARE = [
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'config.urls'
|
||||
|
|
|
@ -1 +1 @@
|
|||
from build import * # NOQA
|
||||
from .build import * # NOQA
|
||||
|
|
|
@ -59,7 +59,7 @@ def with_iter(context, iterable=None):
|
|||
|
||||
def load_data(fileName):
|
||||
# with_iter closes the file when it has finished
|
||||
return csv.reader(with_iter(open(DATA_LOCATION + fileName, 'rt')), delimiter=',')
|
||||
return csv.reader(with_iter(open(DATA_LOCATION + fileName, 'rt', encoding="utf8")), delimiter=',')
|
||||
|
||||
|
||||
def clear_table(model):
|
||||
|
@ -93,7 +93,7 @@ def build_generic(model_classes, file_name, csv_record_to_objects):
|
|||
model_class.objects.bulk_create(batches[model_class])
|
||||
batches[model_class] = []
|
||||
|
||||
for model_class, batch in batches.iteritems():
|
||||
for model_class, batch in batches.items():
|
||||
model_class.objects.bulk_create(batch)
|
||||
|
||||
|
||||
|
|
|
@ -1404,7 +1404,7 @@ class ItemDetailSerializer(serializers.ModelSerializer):
|
|||
sprites_data = json.loads(sprites_data['sprites'])
|
||||
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
|
||||
for key, val in sprites_data.iteritems():
|
||||
for key, val in sprites_data.items():
|
||||
if sprites_data[key]:
|
||||
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
|
||||
|
||||
|
@ -2307,7 +2307,7 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer):
|
|||
|
||||
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
|
||||
for key, val in sprites_data.iteritems():
|
||||
for key, val in sprites_data.items():
|
||||
if sprites_data[key]:
|
||||
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
|
||||
|
||||
|
@ -2525,7 +2525,7 @@ class PokemonDetailSerializer(serializers.ModelSerializer):
|
|||
sprites_data = json.loads(sprites_data['sprites'])
|
||||
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
|
||||
for key, val in sprites_data.iteritems():
|
||||
for key, val in sprites_data.items():
|
||||
if sprites_data[key]:
|
||||
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
Django==1.11
|
||||
Django==2.0
|
||||
Pillow==2.6.1
|
||||
Unipath==1.1
|
||||
coverage==3.6
|
||||
django-appconf==0.6
|
||||
coverage==4.5.1
|
||||
django-appconf==1.0.2
|
||||
django-cors-headers==2.4.0
|
||||
django-discover-runner==0.4
|
||||
django-imagekit==4.0.1
|
||||
django-redis==4.8.0
|
||||
django-cachalot==1.5.0
|
||||
django-tastypie==0.14.0
|
||||
djangorestframework==3.6.4
|
||||
django-discover-runner==1.0
|
||||
django-imagekit==4.0.2
|
||||
django-redis==4.9.0
|
||||
django-cachalot==2.1.0
|
||||
django-tastypie==0.14.2
|
||||
djangorestframework==3.9.0
|
||||
drf-ujson==1.2.0
|
||||
gunicorn==19.4.5
|
||||
gunicorn==19.9.0
|
||||
mimeparse==0.1.3
|
||||
pilkit==2.0
|
||||
psycopg2==2.7.5
|
||||
python-dateutil==2.6.1
|
||||
python-dateutil==2.7.3
|
||||
python-mimeparse==1.6.0
|
||||
simplejson==3.11.1
|
||||
simplejson==3.16.0
|
||||
six==1.11.0
|
||||
wsgiref==0.1.2
|
||||
|
|
Loading…
Reference in a new issue