2021-10-06 12:36:07 +13:00
|
|
|
"""
|
|
|
|
Django settings for right_tree 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/
|
|
|
|
"""
|
|
|
|
|
2021-11-10 17:20:26 +13:00
|
|
|
import os
|
2021-10-06 12:36:07 +13:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
2021-11-16 17:30:40 +13:00
|
|
|
BASE_URL = os.getenv("BASE_URL", "localhost:8000")
|
2021-10-06 12:36:07 +13:00
|
|
|
|
|
|
|
# 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!
|
2021-11-16 17:30:40 +13:00
|
|
|
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", 'django-insecure-5t05qc2&14xuot4lgs#z0ll9(nn-=3-8yks!u(5ce704t&m_*q')
|
2021-10-06 12:36:07 +13:00
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
2021-11-16 17:30:40 +13:00
|
|
|
DEBUG = os.getenv('DJANGO_DEBUG_MODE', '') != 'False'
|
2021-10-06 12:36:07 +13:00
|
|
|
|
2023-02-08 14:24:48 +13:00
|
|
|
# os.getenv("ALLOWED_HOSTS", "").split(","),
|
2021-11-18 11:21:18 +13:00
|
|
|
ALLOWED_HOSTS = [BASE_URL, "localhost"]
|
2021-10-06 12:36:07 +13:00
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2021-10-15 14:31:52 +13:00
|
|
|
'django.contrib.gis',
|
2021-10-07 08:59:57 +13:00
|
|
|
|
|
|
|
'rest_framework',
|
2021-10-07 10:17:32 +13:00
|
|
|
'corsheaders',
|
2021-10-07 08:59:57 +13:00
|
|
|
|
|
|
|
'right_tree.api',
|
2021-10-06 12:36:07 +13:00
|
|
|
]
|
|
|
|
|
|
|
|
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',
|
2021-10-07 10:17:32 +13:00
|
|
|
'corsheaders.middleware.CorsMiddleware',
|
2021-10-06 12:36:07 +13:00
|
|
|
]
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'right_tree.urls'
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'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',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'right_tree.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
2023-02-21 16:43:46 +13:00
|
|
|
db = {
|
|
|
|
'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
|
|
|
'NAME': os.getenv("DATABASE_NAME", "righttree"),
|
|
|
|
'USER': os.getenv("DATABASE_USER", "righttree"),
|
|
|
|
'PASSWORD': os.getenv("DATABASE_PASSWORD", "righttree"),
|
|
|
|
'HOST': os.getenv("DATABASE_HOST", "postgres"),
|
|
|
|
'PORT': int(os.getenv("DATABASE_PORT", 5432)),
|
|
|
|
}
|
2021-10-06 12:36:07 +13:00
|
|
|
DATABASES = {
|
2023-02-21 16:43:46 +13:00
|
|
|
'default': db,
|
|
|
|
'linz': {
|
|
|
|
**db,
|
|
|
|
'OPTIONS': {
|
|
|
|
'options': '-c search_path=linz'
|
|
|
|
},
|
2021-10-06 12:36:07 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Password validation
|
|
|
|
# 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',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
2023-02-21 16:43:46 +13:00
|
|
|
TIME_ZONE = 'Pacific/Auckland'
|
2021-10-06 12:36:07 +13:00
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
|
|
|
|
2021-11-16 17:30:40 +13:00
|
|
|
STATIC_URL = '/staticfiles/'
|
2023-02-21 16:43:46 +13:00
|
|
|
PROJECT_DIR = Path(os.path.abspath(__file__)).parent
|
|
|
|
STATIC_ROOT = PROJECT_DIR / 'staticfiles'
|
|
|
|
MEDIA_ROOT = PROJECT_DIR / 'media'
|
2021-10-06 12:36:07 +13: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'
|
2021-10-07 10:17:32 +13:00
|
|
|
|
|
|
|
CORS_ALLOW_HEADERS = [
|
|
|
|
'access-control-allow-origin'
|
|
|
|
]
|
2023-02-21 16:43:46 +13:00
|
|
|
|
|
|
|
# Celery configuration
|
|
|
|
CELERY_TIMEZONE = TIME_ZONE
|
|
|
|
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL", "redis://redis:6379/0")
|