""" Django settings for back project. Generated by 'django-admin startproject' using Django 5.0.4. For more information on this file, see https://docs.djangoproject.com/en/5.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.0/ref/settings/ """ from pathlib import Path import os from dotenv import load_dotenv load_dotenv() # 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.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "django-insecure-ly8rk@zb&ne*-063&q-=81!d@8q0hh4$&q!_7mtqc81(rlejqd" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [ "localhost", "localhost:8000", "127.0.0.1", "127.0.0.1:8000", "192.168.103.159", "192.168.103.159:8000", "back", "back:8000", "demo.kustarshina.ru", ] CSRF_TRUSTED_ORIGINS = ( "https://demo.kustarshina.ru", "http://localhost", "http://localhost:3011", "http://localhost:4173", "http://localhost:5173", "http://192.168.103.159:3011", "http://192.168.103.159", ) CORS_ORIGIN_ALLOW_ALL = False CORS_ORIGIN_WHITELIST = [ "null", "http://localhost", "http://localhost:3011", "http://localhost:4173", "http://localhost:5173", "http://localhost:8000", "http://192.168.103.159:3011", "http://127.0.0.1", "http://192.168.103.159", "http://192.168.103.159:3000", "http://192.168.103.159:8000", "http://front:4173", "http://front:5173", "http://back:8000", "https://demo.kustarshina.ru", ] # Application definition INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "corsheaders", "django_filters", 'django_extensions', "rest_framework", "crispy_forms", "crispy_bootstrap4", "api", "frontImages", "object", ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "corsheaders.middleware.CorsMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", ] ROOT_URLCONF = "back.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 = "back.wsgi.application" # Database # https://docs.djangoproject.com/en/5.0/ref/settings/#databases DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", # change engine to this "NAME": "interactive_table", # db name you created above "HOST": os.getenv("DB_HOST"), # usually localhost "USER": os.getenv("DB_USER"), # db user you created above or postgres default "PASSWORD": os.getenv( "DB_PASSWORD" ), # db password you created above or postgres "PORT": os.getenv("DB_PORT"), # usually 5432 } } # Password validation # https://docs.djangoproject.com/en/5.0/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.0/topics/i18n/ LANGUAGE_CODE = "en-us" TIME_ZONE = "UTC" USE_I18N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.0/howto/static-files/ STATIC_URL = "static/" # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field REST_FRAMEWORK = { 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'] } CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap4" CRISPY_TEMPLATE_PACK = "bootstrap4" DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" LOGGING = { "version": 1, "disable_existing_loggers": False, "formatters": { "verbose": { "format": "{levelname} {asctime} {module} {process:d} {thread:d} {message}", "style": "{", }, "large": { "format": "%(asctime)s %(levelname)s %(process)d %(filename)s:%(lineno)d " + "%(funcName)s %(message)s " }, "simple": { "format": "{levelname} {asctime} {module} {message}", "style": "{", }, }, "handlers": { "console": { "level": "INFO", "class": "logging.StreamHandler", "formatter": "large", }, }, "root": { "handlers": ["console"], "level": "INFO", }, }