Django频道:没有名为'asgiref.sync'的模块

时间:2018-03-12 22:29:19

标签: python django django-channels

我正在关注频道教程指南(https://media.readthedocs.org/pdf/channels/latest/channels.pdf),并在将频道添加到INSTALLED APPS之后,将ASGI_APPLICATION = 'mysite.routing.application'添加到我的设置文件并创建以下routing.py

# .../routing.py
from channels.routing import ProtocolTypeRouter

application = ProtocolTypeRouter({
      # (http->django views is added by default)
})

运行python manage.py runserver后,我收到此错误:

ModuleNotFoundError: No module named 'asgiref.sync'

我有以下版本的库:

Django (1.11.5)
asgiref (1.1.2)
channels (2.0.2)
...

有人能帮助我吗?我是新手。

1 个答案:

答案 0 :(得分:4)

我发现问题出现在旧版asgiref我只需要更新django并且它也更新了asgiref包。