Skip to content

Commit

Permalink
Set DJANGO_SETTINGS_MODULE earlier in celery config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hareshkainthdbt committed Dec 6, 2024
1 parent d67bea6 commit 3a6b09d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fbr/config/celery.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit 3a6b09d

Please sign in to comment.