Postpone SECRET_KEY evaluation to the qcluster command execution (#332)

* Suppress ImproperlyConfigured within Conf, allowing the exception to be raised specifically during the 'qcluster' command instead.

This ensures build scripts and workflows can freely execute other Django commands (e.g., 'python manage.py collectstatic') without failing due to a missing/empty secret key.

* Closes #279

Co-authored-by: Tug of Peas <19413623+tugofpeas@users.noreply.github.com>
This commit is contained in:
tugofpeas
2026-08-09 03:20:51 +02:00
committed by GitHub
co-authored by Tug of Peas
parent b2651ce86c
commit 97ea3c89a5
2 changed files with 10 additions and 1 deletions
+3
View File
@@ -1,5 +1,6 @@
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.translation import gettext as _
@@ -28,6 +29,8 @@ class Command(BaseCommand):
)
def handle(self, *args, **options):
# Ensure that the cluster starts only if the SECRET_KEY is set, as it is required for signing.
settings.SECRET_KEY
# Set alternative cluster_name before creating the cluster (cluster_name is broker's queue_name, too)
cluster_name = options.get("cluster_name")
if cluster_name: