This repository has been archived on 2022-05-05. You can view files and clone it, but cannot push or open issues or pull requests.
userausfall/userausfall/settings.py

163 lines
3.8 KiB
Python
Raw Normal View History

2021-04-12 09:55:30 +02:00
"""
Django settings for userausfall.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
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__)))
DATA_DIR = os.environ.get("USERAUSFALL_DATA_DIR", BASE_DIR)
# 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 09:58:18 +02:00
SECRET_KEY = os.environ.get("LOCAL_DJANGO_SECRET_KEY")
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",
"userausfall",
"rest_framework",
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",
"NAME": os.path.join(DATA_DIR, "db.sqlite3"),
2021-04-12 09:55:30 +02:00
}
}
# User model
#
2021-10-21 09:58:18 +02:00
AUTH_USER_MODEL = "userausfall.User"
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 09:58:18 +02:00
MEDIA_ROOT = os.path.join(BASE_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
# 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 09:58:18 +02:00
"DEFAULT_AUTHENTICATION_CLASSES": ("rest_framework.authentication.SessionAuthentication",),
2021-04-14 11:21:39 +02:00
}
# Sites Framework
# https://docs.djangoproject.com/en/2.2/ref/contrib/sites/
SITE_ID = 1
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"),
}