Move data access to use-cases and IndexedDB repositories with optional remote fallback, changelog/sync ports, and encrypted local backup. Add production Docker Compose (nginx frontend + optional backend) and Apache host proxy configuration for deployment. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
import os
|
|
from pathlib import Path
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
SECRET_KEY = os.environ.get(
|
|
'SECRET_KEY',
|
|
'django-insecure-social-graph-dev-key-change-in-production',
|
|
)
|
|
DEBUG = os.environ.get('DEBUG', 'True').lower() in ('1', 'true', 'yes')
|
|
ALLOWED_HOSTS = [
|
|
h.strip() for h in os.environ.get('ALLOWED_HOSTS', '*').split(',') if h.strip()
|
|
]
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.auth',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'corsheaders',
|
|
'contacts',
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'config.urls'
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': os.environ.get('DATABASE_PATH', str(BASE_DIR / 'db.sqlite3')),
|
|
}
|
|
}
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
|
'PAGE_SIZE': 100,
|
|
}
|
|
|
|
CORS_ALLOW_ALL_ORIGINS = True
|
|
|
|
# Лимит тела запроса для импорта больших JSON (например, экспорт Monica с сотнями контактов)
|
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 20 * 1024 * 1024 # 20 MB
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|