Hi!
Happy Django user here. Implementing Celery as we speak. It works well if I use runserver, but apache does not work well… I have restarted my workers often, but keep seeing “celery.exceptions.NotRegistered: ‘lightning.tasks.test_task’” in my apache error logs.
For some reason, the apache “environment” does not see/detect my celery tasks, while ./manage.py runserver
does work.
Some background:
- Celery using default RabbitMQ backend, running with debug shows me the worker gets the task:
[tasks]
. test_app.tasks.test_task
- Apache uses WSGI, the wsgi file:
import os
import sys
sys.path.append('/opt/web_proj/webfrontend')
sys.path.append('/opt/web_proj')
os.environ["CELERY_LOADER"] = "django"
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'web_proj.settings')
application = get_wsgi_application()
- Error log:
[Mon Sep 26 13:00:35.316682 2022] [wsgi:error] [pid 45554:tid 140694624315136] [remote 10.0.60.16:61547] celery.exceptions.NotRegistered: 'test_app.tasks.test_task'
All help much appreciated. Have messed with this for 2 hours now…