Closed basitiyidir closed 5 years ago
celery.py
from __future__ import absolute_import
import os
import django
from celery import Celery
from decouple import config
from django.conf import settings
from celery_once import QueueOnce
from time import sleep
app = Celery('myapp')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings')
app.conf.ONCE = settings.CELERY_ONCE
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
settings.py
CELERY_ONCE = {
'backend': 'celery_once.backends.Redis',
'settings': {
'url': 'redis://127.0.0.1:6379/0',
'default_timeout': 60 * 60
}
}
the same
You shouldn't assign app.conf.ONCE
before loading settings with app.config_from_object
because the latter overwrites the whole app.conf
.
@basitiyidir as @mizhgun (thanks for chiming in!) the order of app.conf.ONCE
really matters here.
Did that resolve the issue?
I'm closing this one out, but can re-open it if that is not the case.
It does not work in Django applications. Are you aware?