Django2 settings

This commit is contained in:
Martin Pépin 2018-01-05 00:06:24 +01:00
parent d3cbcf391f
commit 7549c5ce46
3 changed files with 31 additions and 9 deletions

View file

@ -48,12 +48,12 @@ INSTALLED_APPS = [
'pads',
]
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',
]
@ -72,16 +72,15 @@ TEMPLATES = [{
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
],
}
}]
WSGI_APPLICATION = "Ernestophone.wsgi.application"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"ENGINE": "django.db.backends.postgresql",
"NAME": DBNAME,
"USER": DBUSER,
"PASSWORD": DBPASSWD,
@ -89,6 +88,21 @@ DATABASES = {
}
}
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',
},
]
# I18n
LANGUAGE_CODE = 'fr-fr'

View file

@ -2,7 +2,7 @@ import os
from .common import * # noqa
from .common import BASE_DIR, INSTALLED_APPS, MIDDLEWARE_CLASSES
from .common import BASE_DIR, INSTALLED_APPS, MIDDLEWARE
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
@ -10,13 +10,14 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
DEBUG = True
INSTALLED_APPS += ["debug_toolbar"]
MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
["debug_toolbar.middleware.DebugToolbarMiddleware"]
+ MIDDLEWARE_CLASSES
+ MIDDLEWARE
)
STATIC_URL = "/static/"
MEDIA_URL = "/media/"
MEDIA_ROOT = "media"
DATABASES = {
"default": {

View file

@ -30,4 +30,11 @@ urlpatterns = [
path("divers/", gestion_views.divers),
]
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar
from django.conf.urls import include, url
urlpatterns = [
url(r"^__debug__/", include(debug_toolbar.urls)),
] + urlpatterns
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)