Skip to content
Advertisement

python celery invalid value for -A unable to load application

I have a following project directory:

JavaScript

task.py

JavaScript

main.py

JavaScript

When I run a command to initialize celery workers, I get this error:

JavaScript

But when I rename main.py to celery.py as it was earlier there’s no issue.

What am I missing here?

Advertisement

Answer

There are two approaches

  1. import your app to azima/__init__.py
JavaScript

You can omit the last line, celery will recognize the celery app from the import. Then you call celery -A azima worker -l INFO

  1. Call you application like celery -A azima.main worker -l INFO
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement