fixing deploymennt (#8)
Unit Tests / test (push) Successful in 14s

Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
2026-07-25 06:17:46 -07:00
parent d1660792ad
commit ad81257ecb
2 changed files with 16 additions and 4 deletions
+14 -4
View File
@@ -267,7 +267,17 @@ os.makedirs(directory_path, exist_ok=True)
ALLOW_IMAGE_GENERATION = env_bool("ALLOW_IMAGE_GENERATION", False)
ALLOW_INTERNET_ACCESS = env_bool("ALLOW_INTERNET_ACCESS", True)
if DJANGO_ENV in {"prod", "beta"} and (
not SECRET_KEY or "dev-only" in SECRET_KEY or SECRET_KEY.startswith("django-insecure")
):
raise ValueError("DJANGO_SECRET_KEY must be set to a real secret in prod/beta.")
if DJANGO_ENV in {"prod", "beta"}:
# Compose treats $ in .env as variable expansion — escape each $ as $$.
if not SECRET_KEY:
raise ValueError(
"DJANGO_SECRET_KEY is empty in prod/beta. Set it in the control-node "
"secret (~/Documents/secrets/chat_backend/chat_backend_<env>.env). "
"If the value contains $, write $$ or Compose will strip/empty it."
)
if SECRET_KEY.startswith("django-insecure") or "dev-only" in SECRET_KEY:
raise ValueError(
"DJANGO_SECRET_KEY still looks like a placeholder "
"(starts with 'django-insecure' or contains 'dev-only'). "
"Replace it with a real random secret and redeploy."
)