129 lines
3.3 KiB
Python
129 lines
3.3 KiB
Python
"""
|
|
Django settings for whispermaphone project.
|
|
|
|
Generated by 'django-admin startproject' using Django 3.1.1.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/3.1/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/3.1/ref/settings/
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from decouple import config
|
|
import os
|
|
|
|
# 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/3.1/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = config("SECRET_KEY", default="qdm4_0b)3^)k$6r($!o^a7&0l#^6)@g2wr!x0r40ii@9otfnwo")
|
|
|
|
DEBUG = config("DEBUG", default=True, cast=bool)
|
|
|
|
PASSWORD = config("PASSWORD", default="password")
|
|
|
|
ALLOWED_HOSTS = ["thoughts.learnerpages.com"]
|
|
if DEBUG:
|
|
ALLOWED_HOSTS = ["*"]
|
|
|
|
def split_string(string):
|
|
return string.split(",")
|
|
|
|
# A list of colors, background-color, accent-color, text-color. If there are six, first 3 are light and second 3 are dark
|
|
# DO NOT USE THE COLORS I USE. These values right here are black and white, if you're lazy, keep them
|
|
COLORS = config("COLORS", default="#FEFEFE,#222222,#999999", cast=split_string)
|
|
|
|
INSTALLED_APPS = [
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.staticfiles",
|
|
|
|
"haystack",
|
|
|
|
"thoughts",
|
|
]
|
|
|
|
HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor"
|
|
|
|
HAYSTACK_CONNECTIONS = {
|
|
"default": {
|
|
"ENGINE": "xapian_backend.XapianEngine",
|
|
"PATH": str(BASE_DIR / "xapian_index")
|
|
},
|
|
}
|
|
|
|
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 1000000
|
|
|
|
MIDDLEWARE = [
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"django.middleware.common.CommonMiddleware",
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
"whispermaphone.middleware.RemoveSlashMiddleware",
|
|
]
|
|
|
|
CSRF_COOKIE_SECURE = False
|
|
|
|
ROOT_URLCONF = "whispermaphone.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
"DIRS": ["templates"],
|
|
"APP_DIRS": True,
|
|
"OPTIONS": {
|
|
"context_processors": [
|
|
"django.template.context_processors.debug",
|
|
"django.template.context_processors.request",
|
|
"thoughts.settings_context_processor.add_settings"
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "whispermaphone.wsgi.application"
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
"NAME": BASE_DIR / "db.sqlite3",
|
|
}
|
|
}
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/3.1/topics/i18n/
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
|
|
TIME_ZONE = "UTC"
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
APPEND_SLASH = False
|
|
REMOVE_SLASH = True
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
|
|
|
STATIC_URL = "/static/"
|
|
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
|
|
STATIC_ROOT = BASE_DIR / "static/"
|
|
|
|
MEDIA_ROOT = BASE_DIR / "media/"
|
|
MEDIA_URL = "/media/"
|