"""
Django settings for config project.

Generated by 'django-admin startproject' using Django 3.1.6.

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
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
APPS_DIR = str(BASE_DIR / "templates_django")

# -----------------------------------------------------------------------------
# General
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#debug
DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True"

ADMIN_URL = os.getenv("DJANGO_ADMIN_URL", "admin")

# -----------------------------------------------------------------------------
# Applications
# -----------------------------------------------------------------------------
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # Start of your entries
    "templates_django.account",
    "templates_django.core",
]

# -----------------------------------------------------------------------------
# Database
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": os.environ.get("POSTGRES_DB"),
        "USER": os.environ.get("POSTGRES_USER"),
        "PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
        "HOST": os.environ.get("POSTGRES_HOST"),
        "PORT": "5432",
    }
}

# -----------------------------------------------------------------------------
# Authentication
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-user-model
AUTH_USER_MODEL = "account.User"
# https://docs.djangoproject.com/en/3.2/ref/settings/#login-url
LOGIN_URL = "account:login"
# https://docs.djangoproject.com/en/3.2/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = "core:home"
# https://docs.djangoproject.com/en/3.2/ref/settings/#logout-redirect-url
LOGOUT_REDIRECT_URL = "core:home"

# -----------------------------------------------------------------------------
# Passwords
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#password-hashers
PASSWORD_HASHERS = [
    # https://docs.djangoproject.com/en/3.2/topics/auth/passwords/#using-argon2-with-django
    "django.contrib.auth.hashers.Argon2PasswordHasher",
    "django.contrib.auth.hashers.PBKDF2PasswordHasher",
    "django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
    "django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
]

# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
        "OPTIONS": {
            "min_length": 8,
        },
    },
    {
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
    },
]

# -----------------------------------------------------------------------------
# Passwords
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#middleware
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",
]

# -----------------------------------------------------------------------------
# Static
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#static-root
STATIC_ROOT = str(BASE_DIR / "staticfiles")

# https://docs.djangoproject.com/en/3.2/ref/settings/#static-url
STATIC_URL = "/static/"

# https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = [
    str(f"{APPS_DIR}/static"),
]

# https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
]

# -----------------------------------------------------------------------------
# Media
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#media-root
MEDIA_ROOT = str(BASE_DIR / "mediafiles")
# https://docs.djangoproject.com/en/3.2/ref/settings/#media-url
MEDIA_URL = "/media/"

# -----------------------------------------------------------------------------
# URLs
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#root-urlconf
ROOT_URLCONF = "config.urls"
# https://docs.djangoproject.com/en/3.2/ref/settings/#wsgi-application
WSGI_APPLICATION = "config.wsgi.application"

# -----------------------------------------------------------------------------
# Templates
# -----------------------------------------------------------------------------
TEMPLATES = [
    {
        # https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-TEMPLATES-BACKEND
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        # https://docs.djangoproject.com/en/3.2/ref/settings/#template-dirs
        "DIRS": [str(f"{APPS_DIR}/templates")],
        "OPTIONS": {
            # https://docs.djangoproject.com/en/3.2/ref/settings/#template-loaders
            # https://docs.djangoproject.com/en/3.2/ref/templates/api/#loader-types
            "loaders": [
                "django.template.loaders.filesystem.Loader",
                "django.template.loaders.app_directories.Loader",
            ],
            # https://docs.djangoproject.com/en/3.2/ref/settings/#template-context-processors
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "django.template.context_processors.media",
                "django.template.context_processors.static",
            ],
        },
    },
]

# -----------------------------------------------------------------------------
# Internationalization
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/topics/i18n/

# Local time zone. Choices are
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# though not all of them may be available with every OS.
# In Windows, this must be set to your system time zone.
TIME_ZONE = "UTC"

# https://docs.djangoproject.com/en/3.2/ref/settings/#language-code
LANGUAGE_CODE = "en-gb"

# https://docs.djangoproject.com/en/3.2/ref/settings/#site-id
SITE_ID = 1

# https://docs.djangoproject.com/en/3.2/ref/settings/#use-i18n
USE_I18N = True

# https://docs.djangoproject.com/en/3.2/ref/settings/#use-l10n
USE_L10N = True

# https://docs.djangoproject.com/en/3.2/ref/settings/#use-tz
USE_TZ = True

"""
Django settings for config project.

Generated by 'django-admin startproject' using Django 3.1.6.

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
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
APPS_DIR = str(BASE_DIR / "templates_django")

# -----------------------------------------------------------------------------
# General
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#debug
DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True"

ADMIN_URL = os.getenv("DJANGO_ADMIN_URL", "admin")

# -----------------------------------------------------------------------------
# Applications
# -----------------------------------------------------------------------------
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # Start of your entries
    "templates_django.account",
    "templates_django.core",
]

# -----------------------------------------------------------------------------
# Database
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": os.environ.get("POSTGRES_DB"),
        "USER": os.environ.get("POSTGRES_USER"),
        "PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
        "HOST": os.environ.get("POSTGRES_HOST"),
        "PORT": "5432",
    }
}

# -----------------------------------------------------------------------------
# Authentication
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-user-model
AUTH_USER_MODEL = "account.User"
# https://docs.djangoproject.com/en/3.2/ref/settings/#login-url
LOGIN_URL = "account:login"
# https://docs.djangoproject.com/en/3.2/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = "core:home"
# https://docs.djangoproject.com/en/3.2/ref/settings/#logout-redirect-url
LOGOUT_REDIRECT_URL = "core:home"

# -----------------------------------------------------------------------------
# Passwords
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#password-hashers
PASSWORD_HASHERS = [
    # https://docs.djangoproject.com/en/3.2/topics/auth/passwords/#using-argon2-with-django
    "django.contrib.auth.hashers.Argon2PasswordHasher",
    "django.contrib.auth.hashers.PBKDF2PasswordHasher",
    "django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
    "django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
]

# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
        "OPTIONS": {
            "min_length": 8,
        },
    },
    {
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
    },
]

# -----------------------------------------------------------------------------
# Passwords
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#middleware
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",
]

# -----------------------------------------------------------------------------
# Static
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#static-root
STATIC_ROOT = str(BASE_DIR / "staticfiles")

# https://docs.djangoproject.com/en/3.2/ref/settings/#static-url
STATIC_URL = "/static/"

# https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = [
    str(f"{APPS_DIR}/static"),
]

# https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
]

# -----------------------------------------------------------------------------
# Media
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#media-root
MEDIA_ROOT = str(BASE_DIR / "mediafiles")
# https://docs.djangoproject.com/en/3.2/ref/settings/#media-url
MEDIA_URL = "/media/"

# -----------------------------------------------------------------------------
# URLs
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/ref/settings/#root-urlconf
ROOT_URLCONF = "config.urls"
# https://docs.djangoproject.com/en/3.2/ref/settings/#wsgi-application
WSGI_APPLICATION = "config.wsgi.application"

# -----------------------------------------------------------------------------
# Templates
# -----------------------------------------------------------------------------
TEMPLATES = [
    {
        # https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-TEMPLATES-BACKEND
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        # https://docs.djangoproject.com/en/3.2/ref/settings/#template-dirs
        "DIRS": [str(f"{APPS_DIR}/templates")],
        "OPTIONS": {
            # https://docs.djangoproject.com/en/3.2/ref/settings/#template-loaders
            # https://docs.djangoproject.com/en/3.2/ref/templates/api/#loader-types
            "loaders": [
                "django.template.loaders.filesystem.Loader",
                "django.template.loaders.app_directories.Loader",
            ],
            # https://docs.djangoproject.com/en/3.2/ref/settings/#template-context-processors
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "django.template.context_processors.media",
                "django.template.context_processors.static",
            ],
        },
    },
]

# -----------------------------------------------------------------------------
# Internationalization
# -----------------------------------------------------------------------------
# https://docs.djangoproject.com/en/3.2/topics/i18n/

# Local time zone. Choices are
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# though not all of them may be available with every OS.
# In Windows, this must be set to your system time zone.
TIME_ZONE = "UTC"

# https://docs.djangoproject.com/en/3.2/ref/settings/#language-code
LANGUAGE_CODE = "en-gb"

# https://docs.djangoproject.com/en/3.2/ref/settings/#site-id
SITE_ID = 1

# https://docs.djangoproject.com/en/3.2/ref/settings/#use-i18n
USE_I18N = True

# https://docs.djangoproject.com/en/3.2/ref/settings/#use-l10n
USE_L10N = True

# https://docs.djangoproject.com/en/3.2/ref/settings/#use-tz
USE_TZ = True

Django settings for config project.  Generated by 'django-admin startproject' using Django 3.1.6.  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/ # Build paths inside the project like this: BASE_DIR / 'subdir'. # ----------------------------------------------------------------------------- # General # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#debug # ----------------------------------------------------------------------------- # Applications # ----------------------------------------------------------------------------- # Start of your entries # ----------------------------------------------------------------------------- # Database # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#databases # ----------------------------------------------------------------------------- # Authentication # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-user-model # https://docs.djangoproject.com/en/3.2/ref/settings/#login-url # https://docs.djangoproject.com/en/3.2/ref/settings/#login-redirect-url # https://docs.djangoproject.com/en/3.2/ref/settings/#logout-redirect-url # ----------------------------------------------------------------------------- # Passwords # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#password-hashers # https://docs.djangoproject.com/en/3.2/topics/auth/passwords/#using-argon2-with-django # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators # ----------------------------------------------------------------------------- # Passwords # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#middleware # ----------------------------------------------------------------------------- # Static # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#static-root # https://docs.djangoproject.com/en/3.2/ref/settings/#static-url # https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS # https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#staticfiles-finders # ----------------------------------------------------------------------------- # Media # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#media-root # https://docs.djangoproject.com/en/3.2/ref/settings/#media-url # ----------------------------------------------------------------------------- # URLs # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#root-urlconf # https://docs.djangoproject.com/en/3.2/ref/settings/#wsgi-application # ----------------------------------------------------------------------------- # Templates # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-TEMPLATES-BACKEND # https://docs.djangoproject.com/en/3.2/ref/settings/#template-dirs # https://docs.djangoproject.com/en/3.2/ref/settings/#template-loaders # https://docs.djangoproject.com/en/3.2/ref/templates/api/#loader-types # https://docs.djangoproject.com/en/3.2/ref/settings/#template-context-processors # ----------------------------------------------------------------------------- # Internationalization # ----------------------------------------------------------------------------- # https://docs.djangoproject.com/en/3.2/topics/i18n/ # Local time zone. Choices are # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # though not all of them may be available with every OS. # In Windows, this must be set to your system time zone. # https://docs.djangoproject.com/en/3.2/ref/settings/#language-code # https://docs.djangoproject.com/en/3.2/ref/settings/#site-id # https://docs.djangoproject.com/en/3.2/ref/settings/#use-i18n # https://docs.djangoproject.com/en/3.2/ref/settings/#use-l10n # https://docs.djangoproject.com/en/3.2/ref/settings/#use-tz