183 lines
4.1 KiB
Python
183 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Django settings for titivillus project.
|
|
"""
|
|
import os
|
|
|
|
import titivillus.settings_secret
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = titivillus.settings_secret.SECRET_KEY
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = ['steelbea.me']
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.postgres',
|
|
'channels',
|
|
'taggit',
|
|
'user_messages',
|
|
'user.apps.UserConfig',
|
|
'homepage.apps.HomepageConfig',
|
|
'quest.apps.QuestConfig',
|
|
'login.apps.LoginConfig',
|
|
'signup.apps.SignupConfig',
|
|
]
|
|
|
|
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',
|
|
'titivillus.middleware.XRealIPMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'titivillus.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.jinja2.Jinja2',
|
|
'DIRS': ['jinja2',],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'environment': 'titivillus.jinja2.environment',
|
|
'auto_reload': DEBUG,
|
|
},
|
|
},
|
|
{
|
|
'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',
|
|
'user_messages.context_processors.messages',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
SILENCED_SYSTEM_CHECKS = [
|
|
'admin.E404',
|
|
]
|
|
|
|
WSGI_APPLICATION = 'titivillus.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': 'titivillus',
|
|
'USER': 'titivillus',
|
|
'PASSWORD': titivillus.settings_secret.DB_KEY,
|
|
'HOST': 'localhost',
|
|
'PORT': '5432',
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
'OPTIONS': {
|
|
'min_length': 8,
|
|
}
|
|
},
|
|
{
|
|
'NAME': 'user.validators.MaximumLengthValidator',
|
|
'OPTIONS': {
|
|
'max_length': 1024,
|
|
}
|
|
}
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/2.0/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'America/New_York'
|
|
|
|
USE_I18N = False
|
|
|
|
USE_L10N = False
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/2.0/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = '/var/www/html/static/'
|
|
STATICFILES_DIRS = [
|
|
os.path.join(BASE_DIR, 'static'),
|
|
]
|
|
|
|
AUTH_USER_MODEL = 'user.User'
|
|
|
|
PASSWORD_HASHERS = [
|
|
'django.contrib.auth.hashers.Argon2PasswordHasher',
|
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
|
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
|
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
|
|
]
|
|
|
|
ASGI_APPLICATION = 'titivillus.routing.application'
|
|
CHANNEL_LAYERS = {
|
|
'default': {
|
|
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
|
'CONFIG': {
|
|
"hosts": [('127.0.0.1', 6379)],
|
|
},
|
|
},
|
|
}
|
|
|
|
# Image server url
|
|
IMG_SVR_URL = "https://img.steelbea.me/"
|
|
|
|
# Taggit
|
|
TAGGIT_CASE_INSENSITIVE = True
|
|
|
|
# Server user id
|
|
SERVER_USER_ID = 1
|
|
|
|
DEFAULT_FROM_EMAIL = "scribe@steelbea.me"
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_HOST = "mail.steelbea.me"
|
|
EMAIL_HOST_PASSWORD = titivillus.settings_secret.EMAIL_KEY
|
|
EMAIL_HOST_USER = "scribe@steelbea.me"
|
|
EMAIL_PORT = 587
|
|
EMAIL_USE_TLS = True
|