From 3a6b09df05b98c282d9759608dd8a41589c72889 Mon Sep 17 00:00:00 2001 From: Haresh Kainth Date: Fri, 6 Dec 2024 12:32:04 +0000 Subject: [PATCH] Set DJANGO_SETTINGS_MODULE earlier in celery config Moved the os.environ.setdefault call to ensure DJANGO_SETTINGS_MODULE is defined before importing Celery, which helps prevent potential configuration issues. This change enhances the reliability of the Celery application initialization process. --- fbr/config/celery.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fbr/config/celery.py b/fbr/config/celery.py index 96518dc..7ef39f8 100644 --- a/fbr/config/celery.py +++ b/fbr/config/celery.py @@ -1,11 +1,13 @@ +# flake8: noqa + import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") + from celery import Celery from celery.schedules import crontab from dbt_copilot_python.celery_health_check import healthcheck -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") - celery_app = Celery("fbr_celery") celery_app.config_from_object("fbr.config.settings.local", namespace="CELERY")