我已经安装了 Django-Channels,但是在运行 daphne-server 时,出现以下错误:
File "/usr/local/lib/python2.7/dist-packages/channels/asgi.py", line 36, in make_backend
"Cannot import BACKEND %r specified for %s" % (self.configs[name]['BACKEND'], name)
channels.asgi.InvalidChannelLayerError: Cannot import BACKEND 'asgi_redis.RedisChannelLayer' specified for default
我的 settings.py 是:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [os.environ.get('REDIS_URL', 'redis://X.X.X.X:6379')],
},
"ROUTING": "MyProject.routing.channel_routing",
},
}
需要帮助来解决此错误。