204 lines
5.6 KiB
Python
204 lines
5.6 KiB
Python
"""
|
|
Django settings for lottopy_site project.
|
|
|
|
Generated by 'django-admin startproject' using Django 4.0.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/4.0/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/4.0/ref/settings/
|
|
"""
|
|
|
|
from pathlib import Path
|
|
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/4.0/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
#SECRET_KEY = 'EAT A DICK MY SITE IS SECURE'
|
|
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
#DEBUG = False
|
|
DEBUG = os.environ.get('DJANGO_DEBUG', '') != 'True'
|
|
ADMINS = [('Matteo', 'clichemail1@gmail.com')]
|
|
|
|
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]']
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'lottopy.apps.LottopyConfig',
|
|
#'blog.apps.BlogConfig',
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
"whitenoise.runserver_nostatic",
|
|
"django.contrib.staticfiles",
|
|
'fontawesomefree',
|
|
#'ckeditor',
|
|
'crispy_forms',
|
|
'django.contrib.sitemaps',
|
|
#'django.contrib.sites',
|
|
#'django_cleanup.apps.CleanupConfig',
|
|
]
|
|
|
|
SITE_ID = 1
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
#"kolo.middleware.KoloMiddleware",
|
|
'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',
|
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'lottopy_site.urls'
|
|
SESSION_COOKIE_SECURE = os.getenv('SESSION_COOKIE_SECURE_ENABLED') != 'False'
|
|
CSRF_COOKIE_SECURE = os.getenv('CSRF_COOKIE_SECURE_ENABLED') != 'False'
|
|
|
|
# Templates Directory
|
|
TEMPLATE_DIR = os.path.join(BASE_DIR,"templates")
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [TEMPLATE_DIR,os.path.join(TEMPLATE_DIR,'lottopy')],
|
|
'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 = 'lottopy_site.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': BASE_DIR / 'db.sqlite3',
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/4.0/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.0/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_TZ = True
|
|
|
|
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
|
|
|
STATICFILES_DIRS = [
|
|
#os.path.join(BASE_DIR, "static"),
|
|
'/home/williedynamite/projects/django_lottopy/lottopy_site/static',
|
|
'/home/williedynamite/projects/django_lottopy/lottopy_site/lottopy/static',
|
|
]
|
|
|
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
|
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
#CKEDITOR_BASEPATH='/static/ckeditor/'
|
|
#CKEDITOR_UPLOAD_PATH = "uploads/"
|
|
|
|
|
|
# Redis
|
|
#REDIS_HOST = 'localhost'
|
|
#REDIS_PORT = 6379
|
|
CACHES = {
|
|
'default': {
|
|
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
|
'LOCATION': 'redis://127.0.0.1:6379',
|
|
}
|
|
}
|
|
CACHE_TTL = 60 * 60 * 24
|
|
|
|
CELERY_BROKER_URL = 'redis://localhost:6379/0'
|
|
CELERY_RESULT_BACKEND = "redis://localhost:6379/1"
|
|
CELERY_TIMEZONE = "America/Eastern"
|
|
CELERY_TASK_TRACK_STARTED = True
|
|
#CELERY_TASK_TIME_LIMIT = 30 * 60
|
|
|
|
# DataFlair #Logging Information
|
|
LOGGING = {
|
|
'version': 1,
|
|
# Version of logging
|
|
'disable_existing_loggers': False,
|
|
#disable logging
|
|
## Handlers #############################################################
|
|
'handlers': {
|
|
'file': {
|
|
'level': 'DEBUG',
|
|
'class': 'logging.FileHandler',
|
|
'filename': 'dataflair-debug.log',
|
|
},
|
|
########################################################################
|
|
'console': {
|
|
'class': 'logging.StreamHandler',
|
|
},
|
|
},
|
|
## Loggers ####################################################################
|
|
'loggers': {
|
|
'django': {
|
|
'handlers': ['file', 'console'],
|
|
'level': 'DEBUG',
|
|
'propagate': True,
|
|
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG')
|
|
},
|
|
},
|
|
} |