244 lines
7.4 KiB
Python
244 lines
7.4 KiB
Python
"""
|
||
Django settings for touchh project.
|
||
|
||
Generated by 'django-admin startproject' using Django 5.1.4.
|
||
|
||
For more information on this file, see
|
||
https://docs.djangoproject.com/en/5.1/topics/settings/
|
||
|
||
For the full list of settings and their values, see
|
||
https://docs.djangoproject.com/en/5.1/ref/settings/
|
||
"""
|
||
|
||
from pathlib import Path
|
||
|
||
import os
|
||
from dotenv import load_dotenv
|
||
|
||
load_dotenv()
|
||
import os
|
||
from pprint import pprint
|
||
from app_settings.app_settings import load_database_settings
|
||
|
||
|
||
# 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/5.1/howto/deployment/checklist/
|
||
|
||
# SECURITY WARNING: keep the secret key used in production secret!
|
||
SECRET_KEY = 'django-insecure-l_8uu8#p*^zf)9zry80)6u+!+2g1a4tg!wx7@^!uw(+^axyh&h'
|
||
|
||
# SECURITY WARNING: don't run with debug turned on in production!
|
||
DEBUG = True
|
||
|
||
ALLOWED_HOSTS = ['0.0.0.0', '192.168.219.140', '127.0.0.1', 'localhost', '192.168.219.114', '588a-182-226-158-253.ngrok-free.app', '*.ngrok-free.app']
|
||
|
||
CSRF_TRUSTED_ORIGINS = [
|
||
'http://588a-182-226-158-253.ngrok-free.app',
|
||
'https://*.ngrok-free.app', # Это подойдет для любых URL, связанных с ngrok
|
||
]
|
||
|
||
# Application definition
|
||
|
||
INSTALLED_APPS = [
|
||
'jazzmin',
|
||
'django.contrib.admin',
|
||
'django.contrib.auth',
|
||
'django.contrib.contenttypes',
|
||
'django.contrib.sessions',
|
||
'django.contrib.messages',
|
||
'django.contrib.staticfiles',
|
||
'bot',
|
||
'pms_integration',
|
||
'hotels',
|
||
'users',
|
||
'scheduler',
|
||
'antifroud',
|
||
'health_check',
|
||
'health_check.db',
|
||
'health_check.cache',
|
||
'app_settings',
|
||
|
||
]
|
||
|
||
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 = 'touchh.urls'
|
||
|
||
TEMPLATES = [
|
||
{
|
||
'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',
|
||
'django.contrib.messages.context_processors.messages',
|
||
],
|
||
},
|
||
},
|
||
]
|
||
|
||
WSGI_APPLICATION = 'touchh.wsgi.application'
|
||
GEOIP_PATH = os.path.join(BASE_DIR, 'geoip')
|
||
|
||
# Database
|
||
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
||
|
||
DATABASES = {
|
||
'default': {
|
||
'ENGINE': 'django.db.backends.mysql',
|
||
'NAME': os.getenv('DB_NAME'), # Имя базы данных
|
||
'USER': os.getenv('DB_ROOT_USER'), # Имя пользователя базы данных
|
||
'PASSWORD': os.getenv('DB_PASSWORD'), # Пароль пользователя
|
||
'HOST': os.getenv('DB_HOST', default='0.0.0.0'), # Хост (по умолчанию localhost)
|
||
'PORT': os.getenv('DB_PORT', default=3308), # Порт (по умолчанию 3306)
|
||
'ATOMIC_REQUESTS': True,
|
||
|
||
},
|
||
}
|
||
# load_database_settings(DATABASES)
|
||
|
||
# Password validation
|
||
# https://docs.djangoproject.com/en/5.1/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',
|
||
},
|
||
]
|
||
|
||
# settings.py
|
||
|
||
LOGGING = {
|
||
'version': 1,
|
||
'disable_existing_loggers': False,
|
||
'handlers': {
|
||
'file': {
|
||
'level': os.getenv("LOG_LEVEL"),
|
||
'class': 'logging.FileHandler',
|
||
'filename': 'import_hotels.log', # Лог будет записываться в этот файл
|
||
},
|
||
},
|
||
'loggers': {
|
||
'django': {
|
||
'handlers': ['file'],
|
||
'level': os.getenv("LOG_LEVEL"),
|
||
'propagate': True,
|
||
},
|
||
'antifroud': {
|
||
'handlers': ['file'],
|
||
'level': os.getenv("LOG_LEVEL"),
|
||
'propagate': True,
|
||
},
|
||
},
|
||
}
|
||
|
||
|
||
# Internationalization
|
||
# https://docs.djangoproject.com/en/5.1/topics/i18n/
|
||
|
||
LANGUAGE_CODE = 'ru'
|
||
|
||
TIME_ZONE = 'Europe/Moscow'
|
||
|
||
USE_TZ = True
|
||
|
||
USE_I18N = True
|
||
|
||
USE_L10N = True
|
||
|
||
|
||
|
||
# Static files (CSS, JavaScript, Images)
|
||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||
|
||
STATIC_URL = '/static/'
|
||
STATICFILES_DIRS = [BASE_DIR / 'static']
|
||
|
||
|
||
# Default primary key field type
|
||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||
|
||
|
||
JAZZMIN_SETTINGS = {
|
||
"use_bootstrap5": True,
|
||
"site_title": "TOUCHH Hotel Management",
|
||
"site_header": "TOUCHH Hotel Manager Admin",
|
||
"site_brand": "TOUCHH",
|
||
"welcome_sign": "Welcome to TOUCHH Hotel Management System",
|
||
"show_sidebar": True,
|
||
"navigation_expanded": False,
|
||
"hide_models": ["auth", "guests"],
|
||
"order_with_respect_to": ["users", "hotels"],
|
||
"site_logo": None, # Путь к логотипу, например "static/images/logo.png"
|
||
"site_logo_classes": "img-circle", # Классы CSS для логотипа
|
||
"site_icon": None, # Иконка сайта (favicon), например "static/images/favicon.ico"
|
||
"welcome_sign": "Welcome to Touchh Admin", # Приветствие на странице входа
|
||
"copyright": "Touchh", # Кастомный текст в футере
|
||
"icons": {
|
||
"auth": "fas fa-users-cog",
|
||
"users": "fas fa-user-circle",
|
||
"hotels": "fas fa-hotel",
|
||
"hotels.hotel": "fas fa-hotel",
|
||
"hotels.room":"fas fa-bed",
|
||
"hotels.reservation":"fas fa-calendar-week",
|
||
"hotels.userhotel":"fas fa-user-shield",
|
||
"app_settings": "fas fa-wrench",
|
||
"app_settings.telegramsettings":"fab fa-telegram",
|
||
"app_settings.emailsettings":"fab fa-at",
|
||
"app_settings.localdatabase":"fas fa-database",
|
||
"app_settings.globalhotelsettings":"fas fa-hammer",
|
||
"app_settings.globalsystemsettings":"fas fa-cogs",
|
||
"scheduler": "fas fa-clock",
|
||
"pms_integration": "fas fa-sync",
|
||
"antifroud": "fas fa-shield-alt",
|
||
"antifroud.externaldbsettings": "fas fa-database",
|
||
|
||
|
||
},
|
||
"theme": "sandstone",
|
||
"dark_mode_theme": "darkly",
|
||
"footer": {
|
||
"copyright": "SmartSolTech.kr © 2024",
|
||
"version": False,
|
||
},
|
||
"dashboard_links": [
|
||
{"name": "Google", "url": "https://touchh.com", "new_window": True},
|
||
{"name": "Smartsoltech", "url": "https://smartsoltech.kr", "new_window": True}
|
||
],
|
||
|
||
|
||
"show_ui_builder": True,
|
||
"show_ui_builder_breadcrumbs": True,
|
||
"show_ui_builder_tabs": True,
|
||
"show_ui_builder_tabs_breadcrumbs": True,
|
||
|
||
}
|
||
|