From 638277ed07dccb2510b68a7394ef1233a765cf40 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Wed, 25 Oct 2017 00:42:43 +0900 Subject: [PATCH] Update django to 1.11.x --- project/settings.py | 47 +++++++++++++++++++--------- requirements.txt | 2 +- welcome/templates/welcome/index.html | 4 +-- wsgi.py | 2 +- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/project/settings.py b/project/settings.py index 191814f..8855547 100644 --- a/project/settings.py +++ b/project/settings.py @@ -1,23 +1,23 @@ """ Django settings for this project. -Generated by 'django-admin startproject' using Django 1.8.1. +Generated by 'django-admin startproject' using Django 1.11.6. For more information on this file, see -https://docs.djangoproject.com/en/1.8/topics/settings/ +https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.8/ref/settings/ +https://docs.djangoproject.com/en/1.11/ref/settings/ """ -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! # The SECRET_KEY is provided via an environment variable in OpenShift @@ -35,7 +35,7 @@ ALLOWED_HOSTS = ['*'] # Application definition -INSTALLED_APPS = ( +INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -44,19 +44,19 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'debug_toolbar', 'welcome', -) +] -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', -) + 'debug_toolbar.middleware.DebugToolbarMiddleware', +] ROOT_URLCONF = 'project.urls' @@ -80,7 +80,7 @@ WSGI_APPLICATION = 'wsgi.application' # Database -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases from . import database @@ -89,8 +89,27 @@ DATABASES = { } +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + # Internationalization -# https://docs.djangoproject.com/en/1.8/topics/i18n/ +# https://docs.djangoproject.com/en/1.11/topics/i18n/ LANGUAGE_CODE = 'en-us' @@ -104,7 +123,7 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.8/howto/static-files/ +# https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') diff --git a/requirements.txt b/requirements.txt index f5c00ac..4885bf1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -django>=1.8,<1.9 +django>=1.11,<1.12 django-debug-toolbar==1.8 gunicorn==19.4.5 psycopg2==2.7.3.1 diff --git a/welcome/templates/welcome/index.html b/welcome/templates/welcome/index.html index 5c5bafe..5357f9b 100644 --- a/welcome/templates/welcome/index.html +++ b/welcome/templates/welcome/index.html @@ -263,14 +263,14 @@ $ git push

Now it is time to add your own code. - Follow along the Django tutorial to learn more about Django. + Follow along the Django tutorial to learn more about Django.

If you are running Django's development server in your local host, you can see more information about this request using the toolbar on the right.
Please note that by default your Django settings have DEBUG = True and that is not appropriate for production use, but very handy during development.
- Refer to the Deployment Checklist + Refer to the Deployment Checklist before taking this project into a production environment.

diff --git a/wsgi.py b/wsgi.py index 7c2f625..2ef9a16 100644 --- a/wsgi.py +++ b/wsgi.py @@ -4,7 +4,7 @@ WSGI config for project project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see -https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ +https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ import os