ImportError: No module named 'asgiref.base_layer'

ImportError: No module named 'asgiref.base_layer'

我正在尝试 https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django 中的 django 通道示例,但是当我 运行 命令 daphne chat.asgi:channel_layer --port 8888 时它会抛出错误 ImportError:没有名为 'asgiref.base_layer' 的模块。我已经安装了此 example.Below 所需的所有软件包是我的 requirements.txt 文件

asgi-redis==0.13.1
asgiref==0.9
autobahn==0.12.1
channels==0.16.1
daphne==0.9.1
dj-database-url==0.4.0
Django==1.9.7
haikunator==1.0.1
msgpack-python==0.4.7
psycopg2==2.6.1
redis==2.10.5
six==1.10.0
Twisted==16.2.0
txaio==2.2.1
wheel==0.24.0
zope.interface==4.1.3

我正在使用 redis-server 3.2.6 和 python 3.5.2

您安装了比 article uses 更新的 channels 版本,但安装了旧版本的 asgiref。尝试更新到最新版本 asgiref==1.0.0 以解决我们的问题。