[Fixed]-Starting celery with a project's name as a command line parameter issued an error

1👍

It seems your project (application) is not importable.

Your options:

  • Create a proper Python package (setup.py), install it with pip install /project/directory. That will create copy of your files in virtualenv/lib/python-version/site-packages/. By the book, but rarely used approach.
  • pip install -e /project/directory also requires setup.py, will symlink project into site-packages, so it’s a one shot operation for each virtualenv. Widely used among package developers.
  • Take care of sys.path in Python code, before your project is imported. Example:

    import sys
    sys.path.append('/project/directory')
  • Take care of import directories via PYTHONPATH environment variable. Usual platform dependent PATH rules apply (entries separated by : everywhere but ; on Windows). This way is very popular for deployment. Example in shell:

    export PYTHONPATH=/project/directory
    exec /virtualenv/bin/celery worker ...
👤temoto

0👍

I have found a solution here:

http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html

The only thing I needed to do is added a file celery.py to the project’s root directory and then added few lines to init.py placed in the same directory. See docs above.

Leave a comment