Skip to content

Commit 7102707

Browse files
authored
Merge pull request sclorg#109 from tnir/105-update-django-to-1.11
Update django to 1.11.x
2 parents ad54b3b + 638277e commit 7102707

File tree

5 files changed

+48
-20
lines changed

5 files changed

+48
-20
lines changed

project/settings.py

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
"""
22
Django settings for this project.
33
4-
Generated by 'django-admin startproject' using Django 1.8.1.
4+
Generated by 'django-admin startproject' using Django 1.11.6.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.8/topics/settings/
7+
https://docs.djangoproject.com/en/1.11/topics/settings/
88
99
For the full list of settings and their values, see
10-
https://docs.djangoproject.com/en/1.8/ref/settings/
10+
https://docs.djangoproject.com/en/1.11/ref/settings/
1111
"""
1212

13-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1413
import os
1514

15+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1616
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1717

1818

1919
# Quick-start development settings - unsuitable for production
20-
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
20+
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
2323
# The SECRET_KEY is provided via an environment variable in OpenShift
@@ -35,7 +35,7 @@
3535

3636
# Application definition
3737

38-
INSTALLED_APPS = (
38+
INSTALLED_APPS = [
3939
'django.contrib.admin',
4040
'django.contrib.auth',
4141
'django.contrib.contenttypes',
@@ -44,19 +44,19 @@
4444
'django.contrib.staticfiles',
4545
'debug_toolbar',
4646
'welcome',
47-
)
47+
]
4848

49-
MIDDLEWARE_CLASSES = (
49+
MIDDLEWARE = [
50+
'django.middleware.security.SecurityMiddleware',
5051
'django.contrib.sessions.middleware.SessionMiddleware',
5152
'django.middleware.common.CommonMiddleware',
5253
'django.middleware.csrf.CsrfViewMiddleware',
5354
'django.contrib.auth.middleware.AuthenticationMiddleware',
54-
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
5555
'django.contrib.messages.middleware.MessageMiddleware',
5656
'django.middleware.clickjacking.XFrameOptionsMiddleware',
57-
'django.middleware.security.SecurityMiddleware',
5857
'whitenoise.middleware.WhiteNoiseMiddleware',
59-
)
58+
'debug_toolbar.middleware.DebugToolbarMiddleware',
59+
]
6060

6161
ROOT_URLCONF = 'project.urls'
6262

@@ -80,7 +80,7 @@
8080

8181

8282
# Database
83-
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
83+
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
8484

8585
from . import database
8686

@@ -89,8 +89,27 @@
8989
}
9090

9191

92+
# Password validation
93+
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
94+
95+
AUTH_PASSWORD_VALIDATORS = [
96+
{
97+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
98+
},
99+
{
100+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
101+
},
102+
{
103+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
104+
},
105+
{
106+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
107+
},
108+
]
109+
110+
92111
# Internationalization
93-
# https://docs.djangoproject.com/en/1.8/topics/i18n/
112+
# https://docs.djangoproject.com/en/1.11/topics/i18n/
94113

95114
LANGUAGE_CODE = 'en-us'
96115

@@ -104,9 +123,11 @@
104123

105124

106125
# Static files (CSS, JavaScript, Images)
107-
# https://docs.djangoproject.com/en/1.8/howto/static-files/
126+
# https://docs.djangoproject.com/en/1.11/howto/static-files/
108127

109128
STATIC_URL = '/static/'
110129
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
111130

112131
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
132+
133+
INTERNAL_IPS = ['127.0.0.1']

project/urls.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.conf import settings
12
from django.conf.urls import include, url
23
from django.contrib import admin
34

@@ -12,3 +13,9 @@
1213
url(r'^health$', health),
1314
url(r'^admin/', include(admin.site.urls)),
1415
]
16+
17+
if settings.DEBUG:
18+
import debug_toolbar
19+
urlpatterns = [
20+
url(r'^__debug__/', include(debug_toolbar.urls)),
21+
] + urlpatterns

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
django>=1.8,<1.9
2-
django-debug-toolbar==1.5
1+
django>=1.11,<1.12
2+
django-debug-toolbar==1.8
33
gunicorn==19.4.5
44
psycopg2==2.7.3.1
5-
whitenoise==3.0
5+
whitenoise==3.3.1

welcome/templates/welcome/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,14 @@ <h3>Expanding on sample app</h3>
263263
</ol>
264264
<p>
265265
Now it is time to add your own code.
266-
Follow along the <a href="https://docs.djangoproject.com/en/1.8/intro/tutorial01/">Django tutorial</a> to learn more about Django.
266+
Follow along the <a href="https://docs.djangoproject.com/en/1.11/intro/tutorial01/">Django tutorial</a> to learn more about Django.
267267
</p>
268268
<p>
269269
If you are running Django's development server in your local host, you can see more information
270270
about this request using the toolbar on the right.<br>
271271
Please note that by default your Django settings have <code>DEBUG = True</code> and that is not appropriate for production use,
272272
but very handy during development.<br>
273-
Refer to the <a href="https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/">Deployment Checklist</a>
273+
Refer to the <a href="https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/">Deployment Checklist</a>
274274
before taking this project into a production environment.
275275
</p>
276276

wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
88
"""
99

1010
import os

0 commit comments

Comments
 (0)