34 lines
768 B
Python
34 lines
768 B
Python
from __future__ import absolute_import
|
|
import os
|
|
from datetime import timedelta
|
|
|
|
from celery import Celery
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yzk_wechat_event.settings.base')
|
|
|
|
app = Celery('yzk_wechat_event')
|
|
|
|
app.config_from_object('yzk_wechat_event.settings.base', namespace='CELERY')
|
|
|
|
app.autodiscover_tasks()
|
|
|
|
# 定时任务的调度列表,用于注册定时任务
|
|
app.conf.beat_schedule = {
|
|
# 'warning_log': {
|
|
# 'task': 'warning_log',
|
|
# 'schedule': timedelta(minutes=1),
|
|
# },
|
|
}
|
|
|
|
task_routes = {
|
|
}
|
|
#
|
|
app.conf.task_routes = task_routes
|
|
# app.conf.ONCE = {
|
|
# 'backend': 'celery_once.backends.Redis',
|
|
# 'settings': {
|
|
# 'url': 'redis://localhost:6379/12',
|
|
# 'default_timeout': 60 * 60 * 24,
|
|
# }
|
|
# }
|