diff --git a/project/settings.py b/project/settings.py index 99c6b62..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,9 +123,11 @@ 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') STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' + +INTERNAL_IPS = ['127.0.0.1'] diff --git a/project/urls.py b/project/urls.py index 7165878..5c6a8e3 100644 --- a/project/urls.py +++ b/project/urls.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.conf.urls import include, url from django.contrib import admin @@ -12,3 +13,9 @@ urlpatterns = [ url(r'^health$', health), url(r'^admin/', include(admin.site.urls)), ] + +if settings.DEBUG: + import debug_toolbar + urlpatterns = [ + url(r'^__debug__/', include(debug_toolbar.urls)), + ] + urlpatterns diff --git a/requirements.txt b/requirements.txt index 08db289..4885bf1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -django>=1.8,<1.9 -django-debug-toolbar==1.5 +django>=1.11,<1.12 +django-debug-toolbar==1.8 gunicorn==19.4.5 psycopg2==2.7.3.1 -whitenoise==3.0 +whitenoise==3.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.