Reputation: 305
I'm trying to get celery up and running on Heroku as per instructions here
When I try to run "heroku local" however it fives me the following error:
10:05:42 PM worker.1 | Error:
10:05:42 PM worker.1 | Unable to load celery application.
10:05:42 PM worker.1 | The module tasks was not found.
Any help is much appreciated.
EDIT: It should be noted that I have a module tasks.py in my root directory with the following code in it:
import celery
app = celery.Celery('example')
@app.task
def add(x, y):
return x + y
Upvotes: 7
Views: 9044
Reputation: 429
Based on the comments, I think you need to populate the init.py in your project folder (same folder as celery.py). You can follow Celery official documentation.
This is what you should add to __init__.py:
from __future__ import absolute_import, unicode_literals
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ('celery_app',)
Hope this helps.
Upvotes: 4