You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
480 B

import os
from celery import Celery
from django.conf import settings
import django
# 设置环境变量
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ERP_5.settings.dev')
# 注册Celery的APP, ERP_5必须是项目名字
celery_app = Celery('ERP_5')
# 绑定配置文件
celery_app.config_from_object('django.conf:settings', namespace='CELERY')
# 自动从settings.INSTALLED_APPS注册的应用中加载tasks.py
celery_app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)