From 5cf2eef7adfa5ec0e178005a6be1f5bec5565508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=AD=90-=E6=9D=8E?= <1537080775@qq.com> Date: Thu, 1 Aug 2024 14:05:49 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcelery=E6=97=B6=E5=8C=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 木子-李 <1537080775@qq.com> --- backend/application/__init__.py | 5 +++++ backend/application/celery.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/application/__init__.py b/backend/application/__init__.py index e69de29b..b7ddb6f4 100644 --- a/backend/application/__init__.py +++ b/backend/application/__init__.py @@ -0,0 +1,5 @@ +# This will make sure the app is always imported when +# Django starts so that shared_task will use this app. +from .celery import app as celery_app + +__all__ = ('celery_app',) \ No newline at end of file diff --git a/backend/application/celery.py b/backend/application/celery.py index d57b92ad..10bce56c 100644 --- a/backend/application/celery.py +++ b/backend/application/celery.py @@ -15,7 +15,7 @@ else: from celery import Celery app = Celery(f"application") -app.config_from_object('django.conf:settings') +app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) platforms.C_FORCE_ROOT = True -- Gitee