diff --git a/config/settings.py b/config/settings.py index bc258c75..f7cc514c 100755 --- a/config/settings.py +++ b/config/settings.py @@ -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' diff --git a/data/v2/__init__.py b/data/v2/__init__.py index 49fa5896..edae34fb 100644 --- a/data/v2/__init__.py +++ b/data/v2/__init__.py @@ -1 +1 @@ -from build import * # NOQA +from .build import * # NOQA diff --git a/data/v2/build.py b/data/v2/build.py index fce028a1..82cacef2 100644 --- a/data/v2/build.py +++ b/data/v2/build.py @@ -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) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 65c3a5db..21755b2e 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -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/', '') diff --git a/requirements.txt b/requirements.txt index d4c8c16f..6cc3a47e 100755 --- a/requirements.txt +++ b/requirements.txt @@ -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