2023-09-26 07:15:28 +00:00
|
|
|
"""
|
|
|
|
Django settings for trustchain_idhub project.
|
|
|
|
|
|
|
|
Generated by 'django-admin startproject' using Django 4.2.5.
|
|
|
|
|
|
|
|
For more information on this file, see
|
|
|
|
https://docs.djangoproject.com/en/4.2/topics/settings/
|
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
|
|
|
https://docs.djangoproject.com/en/4.2/ref/settings/
|
|
|
|
"""
|
2023-10-18 09:35:08 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
from ast import literal_eval
|
2023-09-26 07:15:28 +00:00
|
|
|
|
|
|
|
from pathlib import Path
|
2023-10-13 19:04:44 +00:00
|
|
|
from django.contrib.messages import constants as messages
|
2023-10-18 09:25:12 +00:00
|
|
|
from decouple import config, Csv
|
2023-10-13 19:04:44 +00:00
|
|
|
|
2023-09-26 07:15:28 +00: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/4.2/howto/deployment/checklist/
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
2023-10-18 09:25:12 +00:00
|
|
|
SECRET_KEY = config('SECRET_KEY')
|
2023-09-26 07:15:28 +00:00
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
2023-10-18 09:25:12 +00:00
|
|
|
DEBUG = config('DEBUG', default=False, cast=bool)
|
2023-10-18 15:30:11 +00:00
|
|
|
DEVELOPMENT = config('DEVELOPMENT', default=False, cast=bool)
|
2023-09-26 07:15:28 +00:00
|
|
|
|
2023-10-18 09:25:12 +00:00
|
|
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv())
|
2023-11-03 12:49:33 +00:00
|
|
|
CSRF_TRUSTED_ORIGINS = config('CSRF_TRUSTED_ORIGINS', default=[], cast=Csv())
|
2023-10-18 09:25:12 +00:00
|
|
|
|
|
|
|
DOMAIN = config("DOMAIN", "http://localhost")
|
|
|
|
|
|
|
|
DEFAULT_FROM_EMAIL = config(
|
|
|
|
'DEFAULT_FROM_EMAIL', default='webmaster@localhost')
|
|
|
|
|
|
|
|
EMAIL_HOST = config('EMAIL_HOST', default='localhost')
|
|
|
|
|
|
|
|
EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='')
|
|
|
|
|
|
|
|
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='')
|
|
|
|
|
|
|
|
EMAIL_PORT = config('EMAIL_PORT', default=25, cast=int)
|
|
|
|
|
|
|
|
EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=False, cast=bool)
|
|
|
|
|
|
|
|
EMAIL_BACKEND = config('EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
|
|
|
|
|
|
|
|
EMAIL_FILE_PATH = config('EMAIL_FILE_PATH', default='/tmp/app-messages')
|
|
|
|
|
|
|
|
ADMINS = config('ADMINS', default='[]', cast=literal_eval)
|
|
|
|
|
|
|
|
MANAGERS = config('MANAGERS', default='[]', cast=literal_eval)
|
2023-09-26 07:15:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2023-09-29 16:06:17 +00:00
|
|
|
'django_extensions',
|
2023-10-11 07:52:05 +00:00
|
|
|
'django_bootstrap5',
|
2023-11-23 17:31:12 +00:00
|
|
|
'django_tables2',
|
2023-10-25 15:49:17 +00:00
|
|
|
'idhub_auth',
|
2023-10-10 06:55:53 +00:00
|
|
|
'idhub'
|
2023-09-26 07:15:28 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
2023-11-28 09:17:59 +00:00
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
2023-09-26 07:15:28 +00:00
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
]
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'trustchain_idhub.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 = 'trustchain_idhub.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': BASE_DIR / 'db.sqlite3',
|
|
|
|
}
|
2023-10-18 09:25:12 +00:00
|
|
|
# 'default': config(
|
|
|
|
# 'DATABASE_URL',
|
|
|
|
# default='sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
|
|
# cast=db_url
|
|
|
|
# )
|
2023-09-26 07:15:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Password validation
|
|
|
|
# https://docs.djangoproject.com/en/4.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/4.2/topics/i18n/
|
|
|
|
|
2023-10-18 09:25:12 +00:00
|
|
|
TIME_ZONE = config('TIME_ZONE', 'UTC')
|
2023-09-26 07:15:28 +00:00
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
|
|
|
|
2023-10-18 09:25:12 +00:00
|
|
|
STATIC_URL = '/static/'
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
|
|
|
STATIC_ROOT = config('STATIC_ROOT')
|
|
|
|
MEDIA_ROOT = config('MEDIA_ROOT', default="idhub/upload")
|
|
|
|
FIXTURE_DIRS = (os.path.join(BASE_DIR, 'fixtures'),)
|
2023-10-20 14:50:53 +00:00
|
|
|
SCHEMAS_DIR = os.path.join(BASE_DIR, 'schemas')
|
2023-09-26 07:15:28 +00:00
|
|
|
|
|
|
|
# Default primary key field type
|
|
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
|
|
|
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
2023-10-18 09:25:12 +00:00
|
|
|
LOGIN_REDIRECT_URL = 'idhub:user_dashboard'
|
2023-10-09 08:55:50 +00:00
|
|
|
LOGOUT_REDIRECT_URL = 'idhub:login'
|
2023-10-13 19:04:44 +00:00
|
|
|
|
|
|
|
MESSAGE_TAGS = {
|
|
|
|
messages.DEBUG: 'alert-secondary',
|
|
|
|
messages.INFO: 'alert-info',
|
|
|
|
messages.SUCCESS: 'alert-success',
|
|
|
|
messages.WARNING: 'alert-warning',
|
|
|
|
messages.ERROR: 'alert-danger',
|
|
|
|
}
|
2023-10-18 15:30:11 +00:00
|
|
|
|
2023-11-08 10:23:53 +00:00
|
|
|
LOCALE_PATHS = [
|
|
|
|
os.path.join(BASE_DIR, 'locale'),
|
|
|
|
]
|
2023-11-22 12:59:09 +00:00
|
|
|
LANGUAGE_CODE="en"
|
|
|
|
# LANGUAGE_CODE="es"
|
2023-11-10 15:22:41 +00:00
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
2023-11-08 10:23:53 +00:00
|
|
|
|
2023-10-25 15:49:17 +00:00
|
|
|
AUTH_USER_MODEL = 'idhub_auth.User'
|