- desktop/ → examples/django-react-desktop-app/ - e2e/ → examples/django-react-site/ - example/ → examples/django-react-site/backend/ - Update Dockerfile.test, Makefile, playwright config, and django.config.mjs path references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
77 lines
1.7 KiB
Python
77 lines
1.7 KiB
Python
"""
|
|
Django settings for the integration test backend.
|
|
|
|
Provides:
|
|
- HTTP server functions (echo, add)
|
|
- WebSocket channels (chat, notifications, presence)
|
|
- JWT authentication
|
|
- Form integration (login, signup, add_email)
|
|
"""
|
|
|
|
import os
|
|
|
|
SECRET_KEY = "integration-test-secret-key-not-for-production"
|
|
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = ["*"]
|
|
|
|
INSTALLED_APPS = [
|
|
"django.contrib.auth",
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.sessions",
|
|
"mizan",
|
|
"testapp",
|
|
]
|
|
|
|
AUTH_USER_MODEL = "testapp.EmailUser"
|
|
|
|
MIDDLEWARE = [
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
]
|
|
|
|
ROOT_URLCONF = "testapp.urls"
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
"NAME": os.path.join(os.path.dirname(__file__), "..", "db.sqlite3"),
|
|
}
|
|
}
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
ASGI_APPLICATION = "testapp.asgi.application"
|
|
|
|
# JWT
|
|
JWT_PRIVATE_KEY = "integration-test-jwt-secret-key"
|
|
JWT_ALGORITHM = "HS256"
|
|
|
|
# Channel layers — Redis when available, in-memory fallback for local dev
|
|
REDIS_URL = os.environ.get("REDIS_URL", "")
|
|
if REDIS_URL:
|
|
CHANNEL_LAYERS = {
|
|
"default": {
|
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
|
"CONFIG": {"hosts": [REDIS_URL]},
|
|
},
|
|
}
|
|
else:
|
|
CHANNEL_LAYERS = {
|
|
"default": {
|
|
"BACKEND": "channels.layers.InMemoryChannelLayer",
|
|
},
|
|
}
|
|
|
|
# Session
|
|
SESSION_ENGINE = "django.contrib.sessions.backends.db"
|
|
|
|
# CORS — allow React dev server
|
|
CSRF_TRUSTED_ORIGINS = [
|
|
"http://localhost:3000",
|
|
"http://localhost:5173",
|
|
"http://localhost:5174",
|
|
]
|