Files
mediacms/cms/celery.py
T

23 lines
678 B
Python
Raw Normal View History

2020-12-15 23:33:43 +02:00
from __future__ import absolute_import
2021-05-26 18:35:21 +03:00
2020-12-15 23:33:43 +02:00
import os
2021-05-26 18:35:21 +03:00
2020-12-15 23:33:43 +02:00
from celery import Celery
2021-09-23 18:34:27 +03:00
from django.conf import settings
2020-12-15 23:33:43 +02:00
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cms.settings")
app = Celery("cms")
app.config_from_object("django.conf:settings")
app.autodiscover_tasks()
app.conf.beat_schedule = app.conf.CELERY_BEAT_SCHEDULE
app.conf.broker_transport_options = {"visibility_timeout": 60 * 60 * 24} # 1 day
# http://docs.celeryproject.org/en/latest/getting-started/brokers/redis.html#redis-caveats
2021-09-23 18:34:27 +03:00
# setting this to settings.py file only is not respected. Setting here too
app.conf.task_always_eager = settings.CELERY_TASK_ALWAYS_EAGER
2020-12-15 23:33:43 +02:00
app.conf.worker_prefetch_multiplier = 1