Merge pull request #109 from tnir/105-update-django-to-1.11

Update django to 1.11.x
This commit is contained in:
Ben Parees 2017-10-24 18:11:56 +02:00 committed by GitHub
commit 71027075d1
5 changed files with 48 additions and 20 deletions

View file

@ -1,23 +1,23 @@
""" """
Django settings for this project. 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 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 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 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__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production # 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! # SECURITY WARNING: keep the secret key used in production secret!
# The SECRET_KEY is provided via an environment variable in OpenShift # The SECRET_KEY is provided via an environment variable in OpenShift
@ -35,7 +35,7 @@ ALLOWED_HOSTS = ['*']
# Application definition # Application definition
INSTALLED_APPS = ( INSTALLED_APPS = [
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
@ -44,19 +44,19 @@ INSTALLED_APPS = (
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'debug_toolbar', 'debug_toolbar',
'welcome', 'welcome',
) ]
MIDDLEWARE_CLASSES = ( MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware',
) 'debug_toolbar.middleware.DebugToolbarMiddleware',
]
ROOT_URLCONF = 'project.urls' ROOT_URLCONF = 'project.urls'
@ -80,7 +80,7 @@ WSGI_APPLICATION = 'wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
from . import database 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 # Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/ # https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
@ -104,9 +123,11 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # 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_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
INTERNAL_IPS = ['127.0.0.1']

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
@ -12,3 +13,9 @@ urlpatterns = [
url(r'^health$', health), url(r'^health$', health),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
] ]
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns

View file

@ -1,5 +1,5 @@
django>=1.8,<1.9 django>=1.11,<1.12
django-debug-toolbar==1.5 django-debug-toolbar==1.8
gunicorn==19.4.5 gunicorn==19.4.5
psycopg2==2.7.3.1 psycopg2==2.7.3.1
whitenoise==3.0 whitenoise==3.3.1

View file

@ -263,14 +263,14 @@ $ git push</pre>
</ol> </ol>
<p> <p>
Now it is time to add your own code. Now it is time to add your own code.
Follow along the <a href="https://docs.djangoproject.com/en/1.8/intro/tutorial01/">Django tutorial</a> to learn more about Django. Follow along the <a href="https://docs.djangoproject.com/en/1.11/intro/tutorial01/">Django tutorial</a> to learn more about Django.
</p> </p>
<p> <p>
If you are running Django's development server in your local host, you can see more information 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.<br> about this request using the toolbar on the right.<br>
Please note that by default your Django settings have <code>DEBUG = True</code> and that is not appropriate for production use, Please note that by default your Django settings have <code>DEBUG = True</code> and that is not appropriate for production use,
but very handy during development.<br> but very handy during development.<br>
Refer to the <a href="https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/">Deployment Checklist</a> Refer to the <a href="https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/">Deployment Checklist</a>
before taking this project into a production environment. before taking this project into a production environment.
</p> </p>

View file

@ -4,7 +4,7 @@ WSGI config for project project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see 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 import os