forked from mike/django
194 lines
5.3 KiB
Python
194 lines
5.3 KiB
Python
"""
|
|
Django settings for dLitepay project.
|
|
|
|
Generated by 'django-admin startproject' using Django 4.2.
|
|
|
|
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/
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from django.contrib.messages import constants as messages
|
|
|
|
# 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!
|
|
SECRET_KEY = 'django-insecure-z#_ppfgs06)e4v18t!970-&-&jkxht!tw&ms#u5n_m-fbxulwa'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = ['10.0.70.5', '127.0.0.1']
|
|
|
|
# User substitution
|
|
# https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#auth-custom-user
|
|
|
|
AUTH_USER_MODEL = 'users.User'
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django_bcrypt',
|
|
'django_otp',
|
|
'django_otp.plugins.otp_static',
|
|
'django_otp.plugins.otp_totp',
|
|
'django_otp.plugins.otp_email', # <- if you want email capability.
|
|
'two_factor',
|
|
'two_factor.plugins.phonenumber', # <- if you want phone number capability.
|
|
'two_factor.plugins.email', # <- if you want email capability.
|
|
#
|
|
'base.apps.BaseConfig',
|
|
'users.apps.UsersConfig',
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django_otp.middleware.OTPMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'dLitepay.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [
|
|
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',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'dLitepay.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
'NAME': 'postgres',
|
|
'USER': 'postgres',
|
|
'PASSWORD': 'xegh3kAJyDLaRu',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '5432',
|
|
}
|
|
}
|
|
|
|
|
|
# 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',
|
|
},
|
|
]
|
|
'''
|
|
PASSWORD_HASHERS = [
|
|
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
|
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
|
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
|
]
|
|
'''
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/4.2/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
TIME_ZONE = 'UTC'
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
|
|
|
STATIC_URL = 'static/'
|
|
STATICFILES_DIRS = [
|
|
BASE_DIR / "src"
|
|
]
|
|
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
|
|
LOGGING = {
|
|
'version': 1,
|
|
'disable_existing_loggers': False,
|
|
'handlers': {
|
|
'console': {
|
|
'level': 'DEBUG',
|
|
'class': 'logging.StreamHandler',
|
|
},
|
|
},
|
|
'loggers': {
|
|
'two_factor': {
|
|
'handlers': ['console'],
|
|
'level': 'INFO',
|
|
}
|
|
}
|
|
}
|
|
|
|
# Messages customize
|
|
|
|
MESSAGE_TAGS = {
|
|
messages.DEBUG: "text-info",
|
|
messages.INFO: "text-info",
|
|
messages.SUCCESS: "text-success",
|
|
messages.WARNING: "text-warning",
|
|
messages.ERROR: "text-danger",
|
|
}
|
|
BCRYPT_ROUNDS = 11
|
|
|
|
PASSWORD_RESET_TIMEOUT = 3600 #
|
|
#LOGIN_URL = 'two_factor:login'
|
|
#OTP_LOGIN_URL = 'account:login'
|
|
|
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
|
SESSION_COOKIE_SECURE = False #to be switched to true when in prod
|
|
CSRF_COOKIE_SECURE = False #to be switched to true when in prod
|
|
SECURE_SSL_REDIRECT = False #to be switched to true when in prod
|
|
SESSION_COOKIE_AGE = 3600
|
|
TWO_FACTOR_REMEMBER_COOKIE_AGE = 3600
|
|
SERVER_EMAIL = 'info@litepay.ch'
|
|
DEFAULT_FROM_EMAIL = 'info@litepay.ch' |