wiki-eleves/WikiENS/settings.default.py

184 lines
4.8 KiB
Python
Raw Normal View History

2017-10-06 14:17:13 +02:00
"""
Django settings for WikiENS project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
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.11/ref/settings/
"""
import os
2019-12-15 23:10:08 +01:00
from django.urls import reverse_lazy
2017-10-06 14:17:13 +02:00
# 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.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
2019-12-15 23:10:08 +01:00
SECRET_KEY = "_u5q4-^1qgkqg=i5o5ha*xkd@82#l$e+%m)$v+4y#t-5!g-%g2"
2017-10-06 14:17:13 +02:00
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
2019-12-15 23:10:08 +01:00
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django.contrib.humanize",
"django_nyt",
"mptt",
"sekizai",
"sorl.thumbnail",
"widget_tweaks",
"shared", # Do not move, so templates in `shared` can override
# thoses in `wiki`
"wiki_groups",
2019-12-15 23:10:08 +01:00
"wiki",
"wiki.plugins.attachments",
"wiki.plugins.notifications",
"wiki.plugins.images",
"wiki.plugins.macros",
"allauth_ens",
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth_ens.providers.clipper",
2017-10-06 14:17:13 +02:00
]
MIDDLEWARE = [
2019-12-15 23:10:08 +01:00
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
2017-10-06 14:17:13 +02:00
]
2019-12-15 23:10:08 +01:00
ROOT_URLCONF = "WikiENS.urls"
2017-10-06 14:17:13 +02:00
TEMPLATES = [
{
2019-12-15 23:10:08 +01:00
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
2017-10-06 14:17:13 +02:00
"sekizai.context_processors.sekizai",
],
},
},
]
2019-12-15 23:10:08 +01:00
WSGI_APPLICATION = "WikiENS.wsgi.application"
2017-10-06 14:17:13 +02:00
SITE_ID = 1
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
2019-12-15 23:10:08 +01:00
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
2017-10-06 14:17:13 +02:00
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
2019-12-15 23:10:08 +01:00
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
2017-10-06 14:17:13 +02:00
},
2019-12-15 23:10:08 +01:00
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",},
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",},
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",},
2017-10-06 14:17:13 +02:00
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
2019-12-15 23:10:08 +01:00
LANGUAGE_CODE = "fr-fr"
2017-10-06 14:17:13 +02:00
2019-12-15 23:10:08 +01:00
TIME_ZONE = "Europe/Paris"
2017-10-06 14:17:13 +02:00
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
2019-12-15 23:10:08 +01:00
STATIC_URL = "/static/"
2017-10-06 14:17:13 +02:00
# Email
# https://docs.djangoproject.com/en/1.11/topics/email/
2019-12-15 23:10:08 +01:00
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# Authentication
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth
# https://django-allauth.readthedocs.io/en/latest/index.html
AUTHENTICATION_BACKENDS = [
2019-12-15 23:10:08 +01:00
"allauth.account.auth_backends.AuthenticationBackend",
]
2019-12-15 23:10:08 +01:00
ACCOUNT_ADAPTER = "shared.allauth_adapter.AccountAdapter"
SOCIALACCOUNT_ADAPTER = "shared.allauth_adapter.SocialAccountAdapter"
2018-03-19 18:22:09 +01:00
2019-12-15 23:10:08 +01:00
HOME_URL = reverse_lazy("wiki:root")
2019-12-15 23:10:08 +01:00
LOGIN_URL = "/_profil/login/"
LOGIN_REDIRECT_URL = HOME_URL
ACCOUNT_LOGOUT_REDIRECT_URL = HOME_URL
ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = False
ACCOUNT_HOME_URL = HOME_URL
ACCOUNT_USER_DISPLAY = lambda u: u.get_full_name() or u.username
2017-10-06 14:17:13 +02:00
# WIKI SETTINGS
LOGOUT_URL = reverse_lazy("account_logout")
# Use sign up, login, logout, profile settings views of allauth.
WIKI_ACCOUNT_HANDLING = False
2017-10-06 14:17:13 +02:00
# Signup allowed? If its not allowed, logged in superusers
# can still access the signup page to create new users.
WIKI_ACCOUNT_SIGNUP_ALLOWED = True
# Globally enable write access for anonymous users, if true anonymous users
# will be treated as the others_write boolean field on models.Article.
WIKI_ANONYMOUS_WRITE = False
2018-03-19 13:51:43 +01:00
WIKI_ANONYMOUS = False