154 lines
3.8 KiB
Python
154 lines
3.8 KiB
Python
from pathlib import Path
|
|
|
|
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
|
|
DJANGO_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
]
|
|
|
|
DJANGO_UNFOLD = [
|
|
"unfold",
|
|
"unfold.contrib.filters",
|
|
"unfold.contrib.forms",
|
|
"unfold.contrib.guardian",
|
|
"unfold.contrib.simple_history",
|
|
]
|
|
|
|
APPS = [
|
|
'core.apps.shared',
|
|
'core.apps.accounts',
|
|
'core.apps.contracts',
|
|
]
|
|
|
|
PACKAGES = [
|
|
'drf_yasg',
|
|
'rest_framework',
|
|
'rest_framework_simplejwt',
|
|
'cacheops',
|
|
]
|
|
|
|
INSTALLED_APPS = []
|
|
INSTALLED_APPS += DJANGO_UNFOLD
|
|
INSTALLED_APPS += DJANGO_APPS
|
|
INSTALLED_APPS += PACKAGES
|
|
INSTALLED_APPS += APPS
|
|
|
|
|
|
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 = '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'
|
|
ASGI_APPLICATION = 'config.asgi.application'
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': env.str('DB_ENGINE'),
|
|
'NAME': env.str('DB_NAME'),
|
|
'USER': env.str('DB_USER'),
|
|
'PASSWORD': env.str('DB_PASSWORD'),
|
|
'HOST': env.str('DB_HOST'),
|
|
'PORT': env.int('DB_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 = 'resources/static/'
|
|
STATIC_ROOT = BASE_DIR / 'resources/static/'
|
|
|
|
|
|
MEDIA_URL = 'resources/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'
|
|
|
|
from config.conf.drf_yasg import *
|
|
from config.conf.rest_framework import *
|
|
from config.conf.simplejwt import *
|
|
from config.conf.celery import *
|
|
from config.conf.redis import *
|
|
from config.conf.unfold import * |