Unifomize license headers
This commit is contained in:
parent
9dc40279fa
commit
8d44182af8
51 changed files with 249 additions and 135 deletions
|
|
@ -1,8 +1,10 @@
|
|||
# This file is part of photo21
|
||||
# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""
|
||||
Django settings for photo21 project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.2.24.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/topics/settings/
|
||||
|
||||
|
|
@ -23,7 +25,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'CHANGE ME'
|
||||
SECRET_KEY = "CHANGE ME"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
|
@ -38,7 +40,7 @@ ALLOWED_HOSTS = [
|
|||
# Admins receive server errors, this is useful to be notified of potential bugs
|
||||
# By default MANAGERS=ADMINS, so admins also receive upload notifications
|
||||
ADMINS = [
|
||||
('admin', 'photos-admin@lists.crans.org'),
|
||||
("admin", "photos-admin@lists.crans.org"),
|
||||
]
|
||||
|
||||
# Use secure cookies in production
|
||||
|
|
@ -53,47 +55,47 @@ SECURE_HSTS_PRELOAD = True
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.admindocs',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'allauth.socialaccount',
|
||||
'allauth_note_kfet',
|
||||
'crispy_forms',
|
||||
'photologue',
|
||||
"django.contrib.admin",
|
||||
"django.contrib.admindocs",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.sites",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"allauth",
|
||||
"allauth.account",
|
||||
"allauth.socialaccount",
|
||||
"allauth_note_kfet",
|
||||
"crispy_forms",
|
||||
"photologue",
|
||||
]
|
||||
|
||||
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.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.contrib.sites.middleware.CurrentSiteMiddleware',
|
||||
"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",
|
||||
"django.middleware.locale.LocaleMiddleware",
|
||||
"django.contrib.sites.middleware.CurrentSiteMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'photo21.urls'
|
||||
ROOT_URLCONF = "photo21.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'photo21/templates')],
|
||||
'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',
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [os.path.join(BASE_DIR, "photo21/templates")],
|
||||
"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",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
@ -101,22 +103,21 @@ TEMPLATES = [
|
|||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
# Needed to login by username in Django admin, regardless of `allauth`
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
|
||||
"django.contrib.auth.backends.ModelBackend",
|
||||
# `allauth` specific authentication methods, such as login by e-mail
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
"allauth.account.auth_backends.AuthenticationBackend",
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'photo21.wsgi.application'
|
||||
WSGI_APPLICATION = "photo21.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,38 +127,38 @@ DATABASES = {
|
|||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
||||
},
|
||||
]
|
||||
|
||||
PASSWORD_HASHERS = [
|
||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
||||
'photo21.hashers.SHA512PasswordHasher',
|
||||
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
|
||||
"photo21.hashers.SHA512PasswordHasher",
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = "UTC"
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
# Limit available languages to this subset
|
||||
LANGUAGES = [
|
||||
('de', _('German')),
|
||||
('en', _('English')),
|
||||
('es', _('Spanish')),
|
||||
('fr', _('French')),
|
||||
("de", _("German")),
|
||||
("en", _("English")),
|
||||
("es", _("Spanish")),
|
||||
("fr", _("French")),
|
||||
]
|
||||
|
||||
# Allow more fields in URL to edit large galleries
|
||||
|
|
@ -166,9 +167,9 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240
|
|||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_URL = "/static/"
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, 'photo21/static'),
|
||||
os.path.join(BASE_DIR, "photo21/static"),
|
||||
]
|
||||
|
||||
# Collect statics to /static/
|
||||
|
|
@ -177,48 +178,48 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static/")
|
|||
|
||||
# Use /media/ for user uploaded media
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_URL = "/media/"
|
||||
|
||||
LOCALE_PATHS = [os.path.join(BASE_DIR, 'photo21/locale')]
|
||||
LOCALE_PATHS = [os.path.join(BASE_DIR, "photo21/locale")]
|
||||
|
||||
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'photo21/fixtures')]
|
||||
FIXTURE_DIRS = [os.path.join(BASE_DIR, "photo21/fixtures")]
|
||||
|
||||
# Do not send email during debug
|
||||
# By default Django sends mails to localhost:25 without authentification
|
||||
if DEBUG:
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
# Mail will be sent from this address
|
||||
SERVER_EMAIL = "photos@crans.org"
|
||||
DEFAULT_FROM_EMAIL = f"Serveur photos <{SERVER_EMAIL}>"
|
||||
EMAIL_SUBJECT_PREFIX = '[Serveur photos] '
|
||||
EMAIL_SUBJECT_PREFIX = "[Serveur photos] "
|
||||
|
||||
# After login redirect user to transfer page
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
|
||||
# Use only one Django Sites
|
||||
SITE_ID = 1
|
||||
|
||||
# Django message
|
||||
MESSAGE_TAGS = {
|
||||
messages.DEBUG: 'alert-secondary',
|
||||
messages.INFO: 'alert-info',
|
||||
messages.SUCCESS: 'alert-success',
|
||||
messages.WARNING: 'alert-warning',
|
||||
messages.ERROR: 'alert-danger',
|
||||
messages.DEBUG: "alert-secondary",
|
||||
messages.INFO: "alert-info",
|
||||
messages.SUCCESS: "alert-success",
|
||||
messages.WARNING: "alert-warning",
|
||||
messages.ERROR: "alert-danger",
|
||||
}
|
||||
|
||||
# Allauth configuration
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
|
||||
ACCOUNT_FORMS = {'signup': 'photo21.forms.CustomSignupForm'}
|
||||
ACCOUNT_FORMS = {"signup": "photo21.forms.CustomSignupForm"}
|
||||
SOCIALACCOUNT_PROVIDERS = {
|
||||
'notekfet': {
|
||||
"notekfet": {
|
||||
# Fetch user profile
|
||||
'SCOPE': ['1_1'],
|
||||
"SCOPE": ["1_1"],
|
||||
},
|
||||
}
|
||||
|
||||
# Use Bootstrap forms
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||
CRISPY_TEMPLATE_PACK = "bootstrap4"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue