""" Django settings for tasksnest project. Generated by 'django-admin startproject' using Django 6.1.1. For more information on this file, see https://docs.djangoproject.com/en/6.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/6.1/ref/settings/ """ import os from pathlib import Path # 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/6.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-x%2-iw9@k2s1td)7m7-ww55w1x(5lh$j*luk8_fbytb-36il%t' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ["localhost", "127.0.0.1", "tasksnest.jorendegraaf.eu"] SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") CSRF_TRUSTED_ORIGINS = [ "https://tasksnest.jorendegraaf.eu", ] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'planner', 'food.apps.FoodConfig', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'planner.middleware.UserTimezoneMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'tasksnest.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'planner.context_processors.appearance', ], }, }, ] WSGI_APPLICATION = 'tasksnest.wsgi.application' # Database # https://docs.djangoproject.com/en/6.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/6.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/6.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Europe/Amsterdam' USE_I18N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/6.1/howto/static-files/ STATIC_URL = 'static/' # Vite writes production assets and its manifest here. In development templates # load modules from the Vite server configured by VITE_DEV_SERVER. VITE_DEV_SERVER = os.environ.get('VITE_DEV_SERVER', 'http://localhost:5173') VITE_USE_DEV_SERVER = os.environ.get('VITE_USE_DEV_SERVER', str(DEBUG)).lower() in {'1', 'true', 'yes'} VITE_MANIFEST_PATH = BASE_DIR / 'planner' / 'static' / 'planner' / 'dist' / '.vite' / 'manifest.json' # Optional Gitea contribution grid on the task dashboard. Read only these # values from the repository's ignored .env file; the process environment wins. def _gitea_env(name, default=''): if name in os.environ: return os.environ[name] env_file = BASE_DIR.parent / '.env' try: lines = env_file.read_text(encoding='utf-8').splitlines() except FileNotFoundError: return default for line in lines: key, separator, value = line.strip().partition('=') if separator and key.strip() == name: value = value.strip() if len(value) >= 2 and value[0] == value[-1] and value[0] in {'"', "'"}: value = value[1:-1] return value return default GITEA_BASE_URL = _gitea_env('GITEA_BASE_URL', 'https://git.jorendegraaf.eu').rstrip('/') GITEA_USERNAME = _gitea_env('GITEA_USERNAME').strip() GITEA_TOKEN = _gitea_env('GITEA_TOKEN').strip() LOGIN_URL = 'planner:login' LOGIN_REDIRECT_URL = 'planner:task-list' LOGOUT_REDIRECT_URL = 'planner:login' # Email # https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration MAILERS = { 'default': { 'BACKEND': 'django.core.mail.backends.console.EmailBackend', }, }