2021-04-12 09:55:30 +02:00
|
|
|
"""
|
|
|
|
Django settings for userausfall.
|
|
|
|
|
|
|
|
For more information on this file, see
|
2021-10-21 10:04:15 +02:00
|
|
|
https://docs.djangoproject.com/en/3.2/topics/settings/
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
2021-10-21 10:04:15 +02:00
|
|
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
2021-04-12 09:55:30 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
2021-10-21 10:04:15 +02:00
|
|
|
from pathlib import Path
|
2021-04-12 09:55:30 +02:00
|
|
|
|
2021-10-21 10:04:15 +02:00
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
DATA_DIR = Path(os.environ.get("USERAUSFALL_DATA_DIR", BASE_DIR))
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
|
|
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
2021-10-21 10:04:15 +02:00
|
|
|
SECRET_KEY = "django-insecure-ngy2599=i5c*5(*bw%gbs&jzb(^p-4zk&6!a8a76tevv$tb9xq"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
2021-10-21 09:58:18 +02:00
|
|
|
"django.contrib.admin",
|
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.messages",
|
|
|
|
"django.contrib.sites",
|
|
|
|
"django.contrib.staticfiles",
|
|
|
|
"rest_framework",
|
2021-10-21 10:29:37 +02:00
|
|
|
"rest_registration",
|
|
|
|
"django_filters",
|
|
|
|
"drf_spectacular",
|
|
|
|
"userausfall",
|
|
|
|
"userausfall.rest_api",
|
2021-04-12 09:55:30 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
2021-10-21 09:58:18 +02: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",
|
2021-04-12 09:55:30 +02:00
|
|
|
]
|
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
ROOT_URLCONF = "userausfall.urls"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2021-10-21 09:58:18 +02: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",
|
2021-04-12 09:55:30 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
WSGI_APPLICATION = "userausfall.wsgi.application"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
|
|
|
|
|
|
|
DATABASES = {
|
2021-10-21 09:58:18 +02:00
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.sqlite3",
|
2021-10-21 10:29:37 +02:00
|
|
|
"NAME": DATA_DIR / "db.sqlite3",
|
2021-04-12 09:55:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Password validation
|
|
|
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
|
|
|
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
|
|
{
|
2021-10-21 09:58:18 +02:00
|
|
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
2021-04-12 09:55:30 +02:00
|
|
|
},
|
|
|
|
{
|
2021-10-21 09:58:18 +02:00
|
|
|
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
2021-04-12 09:55:30 +02:00
|
|
|
},
|
|
|
|
{
|
2021-10-21 09:58:18 +02:00
|
|
|
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
2021-04-12 09:55:30 +02:00
|
|
|
},
|
|
|
|
{
|
2021-10-21 09:58:18 +02:00
|
|
|
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
2021-04-12 09:55:30 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
LANGUAGE_CODE = "de-de"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
TIME_ZONE = "UTC"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
STATIC_URL = "/static/"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Media files
|
|
|
|
# https://docs.djangoproject.com/en/2.2/topics/files/
|
|
|
|
|
2021-10-21 10:29:37 +02:00
|
|
|
MEDIA_ROOT = DATA_DIR / "media"
|
2021-04-12 09:55:30 +02:00
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
MEDIA_URL = "/media/"
|
2021-04-14 10:55:23 +02:00
|
|
|
|
|
|
|
|
2021-10-21 10:29:37 +02:00
|
|
|
# Default primary key field type
|
|
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
|
|
|
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
|
|
|
|
|
|
|
|
# User model
|
|
|
|
#
|
|
|
|
|
|
|
|
AUTH_USER_MODEL = "userausfall.User"
|
|
|
|
|
|
|
|
|
2021-04-14 10:55:23 +02:00
|
|
|
# Sending email
|
|
|
|
# https://docs.djangoproject.com/en/3.2/topics/email/
|
|
|
|
|
2021-10-21 09:58:18 +02:00
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
2021-04-14 11:21:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Django Rest Framework
|
|
|
|
# https://www.django-rest-framework.org/api-guide/settings/
|
|
|
|
|
|
|
|
REST_FRAMEWORK = {
|
2021-10-21 10:29:37 +02:00
|
|
|
"DEFAULT_FILTER_BACKENDS": [
|
|
|
|
"django_filters.rest_framework.DjangoFilterBackend",
|
|
|
|
],
|
|
|
|
"DEFAULT_PARSER_CLASSES": [
|
|
|
|
"djangorestframework_camel_case.parser.CamelCaseFormParser",
|
|
|
|
"djangorestframework_camel_case.parser.CamelCaseMultiPartParser",
|
|
|
|
"djangorestframework_camel_case.parser.CamelCaseJSONParser",
|
|
|
|
],
|
|
|
|
"DEFAULT_PERMISSION_CLASSES": [
|
|
|
|
"rest_framework.permissions.IsAuthenticated",
|
|
|
|
],
|
|
|
|
"DEFAULT_RENDERER_CLASSES": [
|
|
|
|
"djangorestframework_camel_case.render.CamelCaseJSONRenderer",
|
|
|
|
"djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer",
|
|
|
|
],
|
|
|
|
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
|
|
|
"TEST_REQUEST_DEFAULT_FORMAT": "json",
|
|
|
|
}
|
|
|
|
|
|
|
|
REST_REGISTRATION = {
|
|
|
|
"REGISTER_VERIFICATION_ENABLED": False,
|
|
|
|
"REGISTER_EMAIL_VERIFICATION_ENABLED": False,
|
|
|
|
"RESET_PASSWORD_VERIFICATION_ENABLED": False,
|
|
|
|
}
|
|
|
|
|
|
|
|
SPECTACULAR_SETTINGS = {
|
|
|
|
"TITLE": "Userausfall API",
|
|
|
|
"DESCRIPTION": "Account management for systemausfall.org",
|
|
|
|
"VERSION": "0.0.1",
|
|
|
|
"POSTPROCESSING_HOOKS": ["drf_spectacular.contrib.djangorestframework_camel_case.camelize_serializer_fields"],
|
2021-04-14 11:21:39 +02:00
|
|
|
}
|
2021-05-19 12:38:17 +02:00
|
|
|
|
2021-05-21 14:46:34 +02:00
|
|
|
|
|
|
|
# Sites Framework
|
|
|
|
# https://docs.djangoproject.com/en/2.2/ref/contrib/sites/
|
|
|
|
|
|
|
|
SITE_ID = 1
|
|
|
|
|
|
|
|
|
2021-05-19 12:38:17 +02:00
|
|
|
USERAUSFALL_LDAP = {
|
2021-10-21 09:58:18 +02:00
|
|
|
"ADMIN_USER_DN": "cn=admin,dc=local",
|
|
|
|
"ADMIN_USER_PASSWORD": os.environ.get("USERAUSFALL_LDAP_PASSWORD"),
|
2021-05-19 12:38:17 +02:00
|
|
|
}
|