117 lines
2.9 KiB
Python
117 lines
2.9 KiB
Python
import os
|
|
from pathlib import Path
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
|
|
|
# print(os.getenv('DB_PATH'))
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = str(os.getenv('SECRET_KEY'))
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = False
|
|
|
|
ALLOWED_HOSTS = ["*"]
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'bot_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',
|
|
]
|
|
|
|
CSRF_TRUSTED_ORIGINS = ["*"]
|
|
|
|
ROOT_URLCONF = 'notice_bot.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 = 'notice_bot.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': os.environ.get('POSTGRES_DB', 'bot_db'),
|
|
'USER': os.environ.get('POSTGRES_USER', 'bot_user'),
|
|
'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'bot_password'),
|
|
'HOST': os.environ.get('POSTGRES_HOST', 'localhost'),
|
|
'PORT': os.environ.get('POSTGRES_PORT', '5432')
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
|
|
|
pass_valid_path = 'django.contrib.auth.password_validation'
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
'NAME': pass_valid_path + '.UserAttributeSimilarityValidator',
|
|
},
|
|
{
|
|
'NAME': pass_valid_path + '.MinimumLengthValidator',
|
|
},
|
|
{
|
|
'NAME': pass_valid_path + '.CommonPasswordValidator',
|
|
},
|
|
{
|
|
'NAME': pass_valid_path + '.NumericPasswordValidator',
|
|
},
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/5.1/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'ru'
|
|
|
|
TIME_ZONE = 'Asia/Novosibirsk'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_TZ = True
|
|
|
|
STATIC_URL = 'static/'
|
|
|
|
# Default primary key field type
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
STATIC_ROOT = os.path.join(str(BASE_DIR), 'static')
|
|
|
|
|
|
LOG_PATH = os.environ.get('LOG_PATH') |