feat(registry): add new endpoints for registers, exchange, and backups; update routing and configurations
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 3m10s
CI/CD Pipeline / Run Tests (push) Successful in 3m35s
CI/CD Pipeline / Telegram Notify Success (push) Has been skipped
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 2m26s
CI/CD Pipeline / Run Tests (pull_request) Successful in 2m46s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been skipped
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 3m10s
CI/CD Pipeline / Run Tests (push) Successful in 3m35s
CI/CD Pipeline / Telegram Notify Success (push) Has been skipped
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 2m26s
CI/CD Pipeline / Run Tests (pull_request) Successful in 2m46s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been skipped
This commit is contained in:
@@ -40,6 +40,7 @@ INSTALLED_APPS = [
|
||||
"rest_framework",
|
||||
"django_filters",
|
||||
"corsheaders",
|
||||
"rest_framework_simplejwt.token_blacklist",
|
||||
"django_celery_beat",
|
||||
"django_celery_results",
|
||||
"drf_yasg",
|
||||
@@ -47,6 +48,9 @@ INSTALLED_APPS = [
|
||||
"apps.core",
|
||||
"apps.user",
|
||||
"apps.parsers",
|
||||
"apps.registers",
|
||||
"apps.exchange",
|
||||
"apps.backups",
|
||||
]
|
||||
|
||||
# Jazzmin Admin Configuration
|
||||
@@ -78,6 +82,9 @@ JAZZMIN_SETTINGS = {
|
||||
"order_with_respect_to": [
|
||||
"user",
|
||||
"parsers",
|
||||
"registers",
|
||||
"exchange",
|
||||
"backups",
|
||||
"core",
|
||||
"django_celery_beat",
|
||||
],
|
||||
@@ -91,6 +98,9 @@ JAZZMIN_SETTINGS = {
|
||||
"parsers.ParserLoadLog": "fas fa-history",
|
||||
"parsers.IndustrialCertificateRecord": "fas fa-certificate",
|
||||
"parsers.ManufacturerRecord": "fas fa-industry",
|
||||
"registers.Register": "fas fa-book",
|
||||
"registers.Organization": "fas fa-building",
|
||||
"exchange.ExchangeConnection": "fas fa-database",
|
||||
"core.BackgroundJob": "fas fa-tasks",
|
||||
"django_celery_beat.PeriodicTask": "fas fa-clock",
|
||||
"django_celery_beat.CrontabSchedule": "fas fa-calendar-alt",
|
||||
@@ -188,6 +198,12 @@ WSGI_APPLICATION = "core.wsgi.application"
|
||||
ZAKUPKI_TOKEN = os.getenv("ZAKUPKI_TOKEN", "")
|
||||
FNS_LOCK_TTL_SECONDS = 3600
|
||||
PARSER_PROXIES = []
|
||||
BACKUP_ENCRYPTION_KEY = os.getenv("BACKUP_ENCRYPTION_KEY", "")
|
||||
BACKUP_KEY_ID = os.getenv("BACKUP_KEY_ID", "default")
|
||||
BACKUP_EXPORT_DIRECTORY = os.getenv(
|
||||
"BACKUP_EXPORT_DIRECTORY",
|
||||
str(PROJECT_ROOT / "media" / "backups"),
|
||||
)
|
||||
|
||||
|
||||
# Password validation
|
||||
|
||||
@@ -5,23 +5,48 @@ Docker Compose сеть - используются имена сервисов (
|
||||
|
||||
import os
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
from .base import *
|
||||
|
||||
SECRET_KEY = os.getenv("SECRET_KEY", "production-secret-key-mostovik-change-me-2024")
|
||||
DEBUG = os.getenv("DEBUG", "False").lower() == "true"
|
||||
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "*").split(",")
|
||||
|
||||
def _require_env(name: str) -> str:
|
||||
value = os.getenv(name, "").strip()
|
||||
if not value:
|
||||
raise ImproperlyConfigured(f"{name} must be set in production")
|
||||
return value
|
||||
|
||||
|
||||
def _parse_allowed_hosts(raw_value: str) -> list[str]:
|
||||
hosts = [host.strip() for host in raw_value.split(",") if host.strip()]
|
||||
if not hosts:
|
||||
raise ImproperlyConfigured("ALLOWED_HOSTS must contain at least one host")
|
||||
if "*" in hosts:
|
||||
raise ImproperlyConfigured(
|
||||
"ALLOWED_HOSTS must not contain '*' in production"
|
||||
)
|
||||
return hosts
|
||||
|
||||
|
||||
SECRET_KEY = _require_env("SECRET_KEY")
|
||||
DEBUG = os.getenv("DEBUG", "false").strip().lower() == "true"
|
||||
if DEBUG:
|
||||
raise ImproperlyConfigured("DEBUG must be False in production")
|
||||
ALLOWED_HOSTS = _parse_allowed_hosts(_require_env("ALLOWED_HOSTS"))
|
||||
|
||||
# JWT
|
||||
SIMPLE_JWT["SIGNING_KEY"] = SECRET_KEY
|
||||
|
||||
# HTTPS settings (раскомментировать если используется HTTPS)
|
||||
# SECURE_SSL_REDIRECT = True
|
||||
# SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
# SECURE_HSTS_SECONDS = 31536000
|
||||
# SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
||||
# SECURE_HSTS_PRELOAD = True
|
||||
# SESSION_COOKIE_SECURE = True
|
||||
# CSRF_COOKIE_SECURE = True
|
||||
# HTTPS settings
|
||||
SECURE_SSL_REDIRECT = os.getenv("SECURE_SSL_REDIRECT", "true").strip().lower() == "true"
|
||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
SECURE_HSTS_SECONDS = int(os.getenv("SECURE_HSTS_SECONDS", "31536000"))
|
||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = (
|
||||
os.getenv("SECURE_HSTS_INCLUDE_SUBDOMAINS", "true").strip().lower() == "true"
|
||||
)
|
||||
SECURE_HSTS_PRELOAD = os.getenv("SECURE_HSTS_PRELOAD", "true").strip().lower() == "true"
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SECURE = True
|
||||
|
||||
# Database
|
||||
DATABASES = {
|
||||
|
||||
31
src/settings/test_postgres.py
Normal file
31
src/settings/test_postgres.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Production-like test settings (PostgreSQL + real migrations).
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from .test import *
|
||||
|
||||
# Override SQLite with PostgreSQL to match production behavior.
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
"NAME": os.getenv("TEST_POSTGRES_DB", os.getenv("POSTGRES_DB", "mostovik_test")),
|
||||
"USER": os.getenv("TEST_POSTGRES_USER", os.getenv("POSTGRES_USER", "postgres")),
|
||||
"PASSWORD": os.getenv(
|
||||
"TEST_POSTGRES_PASSWORD", os.getenv("POSTGRES_PASSWORD", "postgres")
|
||||
),
|
||||
"HOST": os.getenv("TEST_POSTGRES_HOST", os.getenv("POSTGRES_HOST", "127.0.0.1")),
|
||||
"PORT": os.getenv("TEST_POSTGRES_PORT", os.getenv("POSTGRES_PORT", "5432")),
|
||||
"CONN_MAX_AGE": 0,
|
||||
"TEST": {
|
||||
"NAME": os.getenv(
|
||||
"TEST_POSTGRES_DB",
|
||||
os.getenv("POSTGRES_DB", "mostovik_test"),
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
# Enable real migrations for schema parity checks.
|
||||
globals().pop("MIGRATION_MODULES", None)
|
||||
Reference in New Issue
Block a user