我正在关注频道教程指南(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)
...
有人能帮助我吗?我是新手。
答案 0 :(得分:4)
我发现问题出现在旧版asgiref
我只需要更新django并且它也更新了asgiref包。