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

前端 未结 10 524
情书的邮戳
情书的邮戳 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:10

    Note that older Django projects have the manage.py script in the same directory as the project directory. That is, the structure looks like this:

    - proj/
      - proj/__init__.py
      - proj/celery.py
      - proj/urls.py
      - proj/manage.py
      - proj/settings.py
    

    instead of this:

    - proj/
      - proj/__init__.py
      - proj/celery.py
      - proj/settings.py
      - proj/urls.py
    - manage.py
    

    In this case, you will just have to rename the celery.app file to something different, like celeryapp.py as suggested in the accepted answer above.

提交回复
热议问题