I am trying to set up celery with Django on my development server, running on ubuntu. Following are changes i made.
init.py
from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
__all__ = ['celery_app']
celery.py
from __future__ import absolute_import
import os
from celery import task
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'samplecelery.settings')
app = Celery('samplecelery')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
tasks.py
from __future__ import absolute_import
from celery import shared_task
@shared_task
def add(x, y):
return x + y
@shared_task
def mul(x, y):
return x * y
when i run the command to check the worker for samplecelery
celery -A sampleceleryworker -l info
app=Celery(samplecelery)
It tells me the app is not installed. Any thoughts on what might have gone wrong in this setup?can anyone please help me..... ModuleNotFoundError: No module named 'Celery'