From 1d5ad577aaa9eec8c2c1c2b6091a2b2f80b353c2 Mon Sep 17 00:00:00 2001 From: Haresh Kainth Date: Sat, 7 Dec 2024 00:24:40 +0000 Subject: [PATCH] Refactor environment and Celery configuration setup Relocated Django settings initialization in manage.py into the main function for improved execution. Updated Celery configuration to load settings from Django's settings module, ensuring consistency and adaptability in different environments. --- fbr/config/celery.py | 2 +- fbr/manage.py | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/fbr/config/celery.py b/fbr/config/celery.py index 62cbdf3..f55c7b7 100644 --- a/fbr/config/celery.py +++ b/fbr/config/celery.py @@ -8,7 +8,7 @@ celery_app = Celery("fbr_celery") -celery_app.config_from_object("fbr.config.settings.local", namespace="CELERY") +celery_app.config_from_object("django.conf:settings", namespace="CELERY") celery_app.autodiscover_tasks() diff --git a/fbr/manage.py b/fbr/manage.py index f03979a..37003e1 100755 --- a/fbr/manage.py +++ b/fbr/manage.py @@ -1,18 +1,12 @@ -# flake8: noqa - #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") -import django - -django.setup() - def main(): """Run administrative tasks.""" + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") try: from django.core.management import execute_from_command_line