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.
22 lines
802 B
22 lines
802 B
8 months ago
|
from __future__ import absolute_import, unicode_literals
|
||
|
import os
|
||
|
from celery import Celery
|
||
|
from celery.schedules import crontab
|
||
|
from crossposting_backend.tasks import delayed_post
|
||
|
|
||
|
|
||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'crossposting_backend')
|
||
|
|
||
|
app = Celery('crossposting_backend')
|
||
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||
|
app.autodiscover_tasks()
|
||
|
|
||
|
CELERY_BEAT_SCHEDULE = {
|
||
|
# Задача, которая будет выполнять отложенные публикации
|
||
|
'post-articles': {
|
||
|
'task': 'crossposting_backend.tasks.delayed_post',
|
||
|
'schedule': crontab(minute=0, hour='*'), # Запускать каждую минуту
|
||
|
'args': () # Аргументы задачи, в данном случае их нет
|
||
|
}
|
||
|
}
|