215 lines
6.6 KiB
Python
215 lines
6.6 KiB
Python
import logging
|
|
import os
|
|
import sys
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from cybercode.log_config import *
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
dotenv_path = os.path.join(BASE_DIR, '../.env')
|
|
if os.path.exists(dotenv_path):
|
|
load_dotenv(dotenv_path)
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
DEBUG = True
|
|
SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-key')
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
|
|
APP_VERSION = '1.0.01.4'
|
|
APP_NAME = "Офит"
|
|
APP_DESCRIPTION = "Официальный сайт компании КИБЕРКОД"
|
|
APP_YEARS = f"{2023} - {datetime.now().year}"
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
"unfold", # before django.contrib.admin
|
|
"unfold.contrib.filters", # optional, if special filters are needed
|
|
"unfold.contrib.forms", # optional, if special form elements are needed
|
|
"unfold.contrib.inlines", # optional, if special inlines are needed
|
|
"unfold.contrib.import_export", # optional, if django-import-export package is used
|
|
"unfold.contrib.guardian", # optional, if django-guardian package is used
|
|
"unfold.contrib.simple_history", # optional, if django-simple-history package is used
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'website',
|
|
|
|
'django_ckeditor_5',
|
|
]
|
|
|
|
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 = 'cybercode.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',
|
|
],
|
|
'libraries': {
|
|
'static_with_versioning': 'cybercode.templatetags.static_with_versioning'
|
|
}
|
|
},
|
|
},
|
|
|
|
]
|
|
|
|
WSGI_APPLICATION = 'cybercode.wsgi.application'
|
|
|
|
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',
|
|
},
|
|
]
|
|
|
|
LANGUAGE_CODE = 'ru'
|
|
TIME_ZONE = 'Asia/Krasnoyarsk'
|
|
USE_I18N = True
|
|
USE_TZ = False
|
|
|
|
STATIC_URL = 'static/'
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
|
|
# AUTH_USER_MODEL = 'users.User'
|
|
LOGIN_URL = '/users/login'
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
CSRF_TRUSTED_ORIGINS = ["https://cybercode.pro", "http://cybercode.pro"]
|
|
|
|
CKEDITOR_UPLOAD_PATH = "media/ckeditor/"
|
|
customColorPalette = [
|
|
{
|
|
'color': 'hsl(4, 90%, 58%)',
|
|
'label': 'Red'
|
|
},
|
|
{
|
|
'color': 'hsl(340, 82%, 52%)',
|
|
'label': 'Pink'
|
|
},
|
|
{
|
|
'color': 'hsl(291, 64%, 42%)',
|
|
'label': 'Purple'
|
|
},
|
|
{
|
|
'color': 'hsl(262, 52%, 47%)',
|
|
'label': 'Deep Purple'
|
|
},
|
|
{
|
|
'color': 'hsl(231, 48%, 48%)',
|
|
'label': 'Indigo'
|
|
},
|
|
{
|
|
'color': 'hsl(207, 90%, 54%)',
|
|
'label': 'Blue'
|
|
},
|
|
]
|
|
|
|
# CKEDITOR_5_CUSTOM_CSS = 'app/static/cybercode/styles/editor.css' # optional
|
|
# CKEDITOR_5_FILE_STORAGE = "path_to_storage.CustomStorage" # optional
|
|
CKEDITOR_5_CONFIGS = {
|
|
'simple': {
|
|
'toolbar': [],
|
|
},
|
|
'default': {
|
|
'toolbar': ['heading', '|', 'bold', 'italic', 'link',
|
|
'bulletedList', 'numberedList', 'blockQuote', 'imageUpload', ],
|
|
'contentsCss': ['/static/cybercode/styles/editor.css'],
|
|
'language': 'ru',
|
|
|
|
},
|
|
'extends': {
|
|
'blockToolbar': [
|
|
'paragraph', 'heading1', 'heading2', 'heading3',
|
|
'|',
|
|
'bulletedList', 'numberedList',
|
|
'|',
|
|
'blockQuote',
|
|
],
|
|
'toolbar': ['heading', '|', 'outdent', 'indent', '|', 'bold', 'italic', 'link', 'underline', 'strikethrough',
|
|
'code', 'subscript', 'superscript', 'highlight', '|', 'codeBlock', 'sourceEditing', 'insertImage',
|
|
'bulletedList', 'numberedList', 'todoList', '|', 'blockQuote', 'imageUpload', '|',
|
|
'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', 'mediaEmbed', 'removeFormat',
|
|
'insertTable', ],
|
|
'language': 'ru',
|
|
'image': {
|
|
'toolbar': ['imageTextAlternative', '|', 'imageStyle:alignLeft',
|
|
'imageStyle:alignRight', 'imageStyle:alignCenter', 'imageStyle:side', '|'],
|
|
'styles': [
|
|
'full',
|
|
'side',
|
|
'alignLeft',
|
|
'alignRight',
|
|
'alignCenter',
|
|
]
|
|
|
|
},
|
|
'table': {
|
|
'contentToolbar': ['tableColumn', 'tableRow', 'mergeTableCells',
|
|
'tableProperties', 'tableCellProperties'],
|
|
'tableProperties': {
|
|
'borderColors': customColorPalette,
|
|
'backgroundColors': customColorPalette
|
|
},
|
|
'tableCellProperties': {
|
|
'borderColors': customColorPalette,
|
|
'backgroundColors': customColorPalette
|
|
}
|
|
},
|
|
'heading': {
|
|
'options': [
|
|
{'model': 'paragraph', 'title': 'Paragraph', 'class': 'ck-heading_paragraph'},
|
|
{'model': 'heading1', 'view': 'h1', 'title': 'Heading 1', 'class': 'ck-heading_heading1'},
|
|
{'model': 'heading2', 'view': 'h2', 'title': 'Heading 2', 'class': 'ck-heading_heading2'},
|
|
{'model': 'heading3', 'view': 'h3', 'title': 'Heading 3', 'class': 'ck-heading_heading3'}
|
|
]
|
|
}
|
|
},
|
|
'list': {
|
|
'properties': {
|
|
'styles': 'true',
|
|
'startIndex': 'true',
|
|
'reversed': 'true',
|
|
}
|
|
},
|
|
}
|
|
|
|
try:
|
|
from cybercode.local_settings import *
|
|
except ModuleNotFoundError:
|
|
from cybercode.production_settings import *
|