0

我正在尝试通过诗歌运行命令并不断收到此错误:

Traceback (most recent call last):
  File "manage.py", line 30, in <module>
    execute_from_command_line(sys.argv)
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/pollsapi_w_template/users/models.py", line 11, in <module>
    from pollsapi_w_template.users.emails import RestorePasswordEmail, VerificationEmail
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/pollsapi_w_template/users/emails.py", line 3, in <module>
    from snitch.emails import TemplateEmailMessage
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/snitch/emails.py", line 11, in <module>
    from snitch.tasks import send_email_asynchronously
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/snitch/tasks.py", line 3, in <module>
    from celery.task import task
ModuleNotFoundError: No module named 'celery.task'

我在通过创建的虚拟环境中,例如poetry.toml我正在尝试运行。poetry run python manage.py migrate

我尝试poetry add celery了以下结果:

RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.", RuntimeWarning)

Python 2.7 will no longer be supported in the next feature release of Poetry (1.2).You should consider updating your Python version to a supported one.

Note that you will still be able to manage Python 2.7 projects by using the env command.
See https://python-poetry.org/docs/managing-environments/ for more information.

Updating dependencies
Resolving dependencies... (1.9s)

Writing lock file

No dependencies to install or update
4

1 回答 1

0

我解决了,这是一个版本错误:似乎 celery 5.0 没有任务模块。

我通过运行解决了它poetry add celery@4.4.0

于 2020-11-03T10:40:45.843 回答