199 lines
5.0 KiB
Python
199 lines
5.0 KiB
Python
"""
|
|
Django settings for puchar project.
|
|
|
|
Generated by 'django-admin startproject' using Django 3.2.5.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/3.2/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from dotenv import load_dotenv
|
|
import os
|
|
|
|
load_dotenv()
|
|
|
|
# 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.2/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
DEBUG = int(os.getenv('DEBUG')) == 1
|
|
SECRET_KEY = os.getenv('SECRET_KEY')
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_USE_TLS = True
|
|
EMAIL_USE_SSL = False
|
|
EMAIL_HOST = os.getenv('EMAIL_HOST')
|
|
EMAIL_PORT = int(os.getenv('EMAIL_PORT'))
|
|
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
|
|
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django_cleanup',
|
|
'crispy_forms',
|
|
'django_crispy_bulma',
|
|
'django_summernote',
|
|
'app'
|
|
]
|
|
|
|
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',
|
|
]
|
|
|
|
ROOT_URLCONF = 'puchar.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 = 'puchar.wsgi.application'
|
|
X_FRAME_OPTIONS = 'SAMEORIGIN'
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
'NAME': 'puchar_lo5',
|
|
'USER': os.getenv('DB_USER'),
|
|
'PASSWORD': os.getenv('DB_PASSWORD'),
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '5432'
|
|
}
|
|
}
|
|
|
|
ATOMIC_REQUESTS = True
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
},
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'pl-PL'
|
|
|
|
TIME_ZONE = 'Europe/Warsaw'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
STATICFILES_DIRS = [
|
|
BASE_DIR / 'app/static'
|
|
]
|
|
|
|
STATIC_ROOT = BASE_DIR / 'static'
|
|
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = BASE_DIR / 'media'
|
|
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
AUTH_USER_MODEL = 'app.School'
|
|
|
|
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bulma'
|
|
CRISPY_TEMPLATE_PACK = 'bulma'
|
|
CRISPY_CLASS_CONVERTERS = {
|
|
"select": "select is-pulled-right",
|
|
"emailinput": "input",
|
|
"numberinput": "input",
|
|
"textinput": "input",
|
|
"fileinput": "fileinput fileUpload",
|
|
"passwordinput": "input",
|
|
}
|
|
SUMMERNOTE_THEME = 'lite'
|
|
|
|
LOGIN_URL = 'login'
|
|
LOGIN_REDIRECT_URL = 'news'
|
|
LOGOUT_REDIRECT_URL = 'news'
|
|
|
|
SUMMERNOTE_CONFIG = {
|
|
# You can put custom Summernote settings
|
|
'summernote': {
|
|
# As an example, using Summernote Air-mode
|
|
'airMode': False,
|
|
|
|
# Change editor size
|
|
'width': '100%',
|
|
'height': '480',
|
|
|
|
# Use proper language setting automatically (default)
|
|
'lang': 'pl-PL',
|
|
|
|
# Toolbar customization
|
|
# https://summernote.org/deep-dive/#custom-toolbar-popover
|
|
'toolbar': [
|
|
['style', ['style']],
|
|
['font', ['bold', 'underline', 'clear']],
|
|
['fontname', ['fontname']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph']],
|
|
['table', ['table']],
|
|
['insert', ['link', 'picture', 'video']],
|
|
['view', ['fullscreen', 'codeview', 'help']],
|
|
],
|
|
},
|
|
|
|
# You can completely disable the attachment feature.
|
|
'disable_attachment': True
|
|
}
|