Django, ImportError: cannot import name Celery, possible circular import?

前端 未结 10 519
情书的邮戳
情书的邮戳 2021-01-31 14:43

I went through this example here:

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

All my tasks are in files called tasks.py.

10条回答
  •  隐瞒了意图╮
    2021-01-31 15:08

    Adding the following lines to cloud/celery.py:

    import celery
    print celery.__file__
    

    gave me the file itself and not the celery module from the library. After renaming celery.py to celeryapp.py and adjusting the imports all errors were gone.

    Note:

    That leads to a change in starting the worker:

    celery worker --app=cloud.celeryapp:app
    

    For those running celery==3.1.2 and getting this error:

    TypeError: unpack_from() argument 1 must be string or read-only buffer, not memoryview
    

    Apply the patch mentioned here: https://github.com/celery/celery/issues/1637

提交回复
热议问题