Ultron/config/settings.py

173 lines
4.7 KiB
Python
Raw Normal View History

2021-12-09 16:17:38 +01:00
"""
Django settings for Ultron project.
Generated by 'django-admin startproject' using Django 3.2.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
import environ
2022-02-15 17:49:35 +01:00
from pathlib import Path
2021-12-09 16:17:38 +01:00
# Initialise environment variables
env = environ.Env()
environ.Env.read_env()
2022-02-16 09:31:46 +01:00
# Sentry
SENTRY_DSN = env("SENTRY_DSN", default=None)
if SENTRY_DSN is not None:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()],
2022-02-16 10:18:11 +01:00
traces_sample_rate=env("SENTRY_TRACES_SAMPLE_RATE", default=1.0),
2022-02-16 09:31:46 +01:00
send_default_pii=True,
2022-10-29 16:10:01 +02:00
debug=env("SENTRY_DEBUG", default=True),
2022-02-16 09:31:46 +01:00
)
2021-12-09 16:17:38 +01:00
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
2022-10-29 16:10:01 +02:00
SECRET_KEY = env("SECRET_KEY", default="Super Little Poney 2000")
2021-12-09 16:17:38 +01:00
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
2022-10-29 16:10:01 +02:00
ALLOWED_HOSTS = env("ALLOWED_HOSTS", default="localhost").split()
2021-12-09 16:17:38 +01:00
# Application definition
INSTALLED_APPS = [
2022-10-29 16:10:01 +02:00
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django_admin_listfilter_dropdown",
"django_extensions",
"ultron.core",
2022-10-29 16:10:01 +02:00
"ultron.location",
"ultron.people",
"ultron.followup",
"ultron.tools",
"ultron.profiles",
"ultron.planning",
"ultron.objective",
2021-12-09 16:17:38 +01:00
]
MIDDLEWARE = [
2022-10-29 16:10:01 +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",
"whitenoise.middleware.WhiteNoiseMiddleware",
2021-12-09 16:17:38 +01:00
]
2022-10-29 16:10:01 +02:00
ROOT_URLCONF = "config.urls"
2021-12-09 16:17:38 +01:00
TEMPLATES = [
{
2022-10-29 16:10:01 +02:00
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
os.path.join(BASE_DIR, "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",
"ultron.core.context_processors.git_describe",
2021-12-09 16:17:38 +01:00
],
},
},
]
2022-10-29 16:10:01 +02:00
WSGI_APPLICATION = "config.wsgi.application"
2021-12-09 16:17:38 +01:00
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
2022-10-29 16:10:01 +02:00
DATABASES = {"default": env.db_url("DATABASE_URL", default="sqlite:///ultron.db")}
2021-12-09 16:17:38 +01:00
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
2022-10-29 16:10:01 +02:00
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
2021-12-09 16:17:38 +01:00
},
{
2022-10-29 16:10:01 +02:00
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
2021-12-09 16:17:38 +01:00
},
{
2022-10-29 16:10:01 +02:00
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
2021-12-09 16:17:38 +01:00
},
{
2022-10-29 16:10:01 +02:00
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
2021-12-09 16:17:38 +01:00
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
2022-10-29 16:10:01 +02:00
LANGUAGE_CODE = "en-us"
2021-12-09 16:17:38 +01:00
2022-10-29 16:10:01 +02:00
TIME_ZONE = "UTC"
2021-12-09 16:17:38 +01:00
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOGIN_URL = "/login/"
LOGOUT_URL = "/logout/"
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = "/static/"
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
2022-10-29 16:10:01 +02:00
STATIC_ROOT = BASE_DIR / "staticfiles"
2021-12-09 16:17:38 +01:00
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
2022-10-29 16:10:01 +02:00
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
2021-12-09 16:17:38 +01:00
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
2022-10-29 16:10:01 +02:00
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
2022-11-19 18:51:20 +01:00
SITE_TITLE = env("SITE_TITLE", default=None)
CLUB_NAME = env("CLUB_NAME", default=None)
ADDRESS = env("ADDRESS", default=None)
CITY = env("CITY", default=None)
ZIP = env("ZIP", default=None)
HEAD_COACH = env("HEAD_COACH", default=None)
MOBILE_PHONE = env("MOBILE_PHONE", default=None)
HEAD_COACH_EMAIL = env("HEAD_COACH_EMAIL", default=None)