Titivillus/titivillus/settings.py

183 lines
4.1 KiB
Python
Raw Normal View History

2018-08-10 08:39:51 -04:00
#!/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',
2018-10-02 11:35:39 -04:00
'django.contrib.postgres',
2018-08-14 20:12:52 -04:00
'channels',
2018-10-02 11:35:39 -04:00
'taggit',
2018-10-12 10:34:57 -04:00
'user_messages',
2018-09-05 14:13:47 -04:00
'user.apps.UserConfig',
2018-08-10 08:39:51 -04:00
'homepage.apps.HomepageConfig',
'quest.apps.QuestConfig',
'login.apps.LoginConfig',
'signup.apps.SignupConfig',
2018-08-10 08:39:51 -04: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',
2018-08-30 13:33:08 -04:00
'titivillus.middleware.XRealIPMiddleware',
2018-08-10 08:39:51 -04:00
]
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',
2018-10-12 10:34:57 -04:00
#'django.contrib.messages.context_processors.messages',
'user_messages.context_processors.messages',
],
},
},
2018-08-10 08:39:51 -04:00
]
2019-04-13 17:08:32 -04:00
SILENCED_SYSTEM_CHECKS = [
'admin.E404',
]
2018-08-10 08:39:51 -04:00
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,
2019-04-13 17:08:32 -04:00
'HOST': 'localhost',
'PORT': '5432',
2018-08-10 08:39:51 -04:00
}
}
# 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,
}
2018-08-10 08:39:51 -04:00
},
{
2018-09-05 14:13:47 -04:00
'NAME': 'user.validators.MaximumLengthValidator',
'OPTIONS': {
'max_length': 1024,
}
}
2018-08-10 08:39:51 -04:00
]
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
2018-08-21 09:01:16 -04:00
TIME_ZONE = 'America/New_York'
2018-08-10 08:39:51 -04:00
USE_I18N = False
2018-08-10 08:39:51 -04:00
USE_L10N = False
2018-08-10 08:39:51 -04:00
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_URL = '/static/'
2019-04-13 17:08:32 -04:00
STATIC_ROOT = '/var/www/html/static/'
2018-08-10 08:39:51 -04:00
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
2018-09-05 14:13:47 -04:00
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',
]
2018-08-14 20:12:52 -04:00
ASGI_APPLICATION = 'titivillus.routing.application'
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('127.0.0.1', 6379)],
},
},
}
2018-09-18 11:45:12 -04:00
# Image server url
IMG_SVR_URL = "https://img.steelbea.me/"
2018-10-02 11:35:39 -04:00
# Taggit
TAGGIT_CASE_INSENSITIVE = True
2018-10-08 10:22:36 -04:00
# Server user id
2019-04-13 17:08:32 -04:00
SERVER_USER_ID = 1
2019-01-21 15:59:31 -05:00
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