165 lines
4.1 KiB
Python
165 lines
4.1 KiB
Python
from datetime import timedelta
|
|
from pathlib import Path
|
|
|
|
from config.conf.celery import *
|
|
from config.conf.cors_headers import *
|
|
from config.conf.drf_yasg import *
|
|
from config.conf.jazzmin import *
|
|
from config.conf.logs import *
|
|
from config.conf.redis import *
|
|
from config.conf.rest_framework import *
|
|
from config.conf.rest_framework_simplejwt import *
|
|
from config.env import env
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = env.str("SECRET_KEY")
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = env.bool("DEBUG")
|
|
|
|
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS")
|
|
|
|
|
|
# Application definition
|
|
APPS = [
|
|
"core.apps.accounts",
|
|
"core.apps.shared",
|
|
"core.apps.company",
|
|
"core.apps.wherehouse",
|
|
"core.apps.products",
|
|
"core.apps.projects",
|
|
"core.apps.orders",
|
|
"core.apps.finance",
|
|
"core.apps.counterparty",
|
|
"core.apps.notifications",
|
|
]
|
|
|
|
PACKAGES = [
|
|
"drf_yasg",
|
|
"rest_framework",
|
|
"rest_framework_simplejwt",
|
|
"corsheaders",
|
|
"cacheops",
|
|
]
|
|
|
|
DJANGO_APPS = [
|
|
"jazzmin",
|
|
"django.contrib.admin",
|
|
"django.contrib.auth",
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.sessions",
|
|
"django.contrib.messages",
|
|
"django.contrib.staticfiles",
|
|
]
|
|
|
|
INSTALLED_APPS = []
|
|
INSTALLED_APPS += DJANGO_APPS
|
|
INSTALLED_APPS += PACKAGES
|
|
INSTALLED_APPS += APPS
|
|
|
|
|
|
MIDDLEWARE = [
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
"corsheaders.middleware.CorsMiddleware",
|
|
"django.middleware.common.CommonMiddleware",
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
# 'silk.middleware.SilkyMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = "config.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
"DIRS": [],
|
|
"APP_DIRS": True,
|
|
"OPTIONS": {
|
|
"context_processors": [
|
|
"django.template.context_processors.request",
|
|
"django.contrib.auth.context_processors.auth",
|
|
"django.contrib.messages.context_processors.messages",
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "config.wsgi.application"
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.postgresql",
|
|
"NAME": env.str("POSTGRES_DB"),
|
|
"USER": env.str("POSTGRES_USER"),
|
|
"PASSWORD": env.str("POSTGRES_PASSWORD"),
|
|
"HOST": env.str("POSTGRES_HOST"),
|
|
"PORT": env.str("POSTGRES_PORT"),
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/5.2/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/5.2/topics/i18n/
|
|
|
|
LANGUAGE_CODE = "uz"
|
|
|
|
TIME_ZONE = "Asia/Tashkent"
|
|
|
|
USE_I18N = True
|
|
|
|
USE_TZ = False
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
|
|
|
STATIC_URL = "static/"
|
|
STATIC_ROOT = BASE_DIR / "resources/static"
|
|
MEDIA_URL = "media/"
|
|
MEDIA_ROOT = BASE_DIR / "resources/media"
|
|
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
AUTH_USER_MODEL = "accounts.User"
|
|
|
|
SECURE_PROXY_SSL_HEADER = (
|
|
"HTTP_X_FORWARDED_PROTO",
|
|
env.str("SWAGGER_PROTOCOL", "https"),
|
|
)
|