django-vue-admin/backend/application/celery.py

18 lines
522 B
Python
Raw Normal View History

2022-04-05 05:22:26 +00:00
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings')
from django.conf import settings
from application import dispatch
2022-04-05 05:22:26 +00:00
from celery import platforms
if dispatch.is_tenants_mode():
2022-04-05 05:22:26 +00:00
from tenant_schemas_celery.app import CeleryApp as TenantAwareCeleryApp
app = TenantAwareCeleryApp()
else:
from celery import Celery
app = Celery(f"application")
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
platforms.C_FORCE_ROOT = True