channels.exceptions.invalidchannellayererror:无法导入后端“channels\u redis.core.redischannellayer”

u3r8eeie  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(379)

我有一个django项目,它使用redis作为通道层,但是每当我运行服务器时,我都会遇到一个错误
下面是完整的回溯

Traceback (most recent call last):
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/staticfiles.py", line 44, in __call__
    return await self.application(scope, receive, send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/routing.py", line 71, in __call__
    return await application(scope, receive, send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/sessions.py", line 47, in __call__
    return await self.inner(dict(scope, cookies=cookies), receive, send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/sessions.py", line 254, in __call__
    return await self.inner(wrapper.scope, receive, wrapper.send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/auth.py", line 181, in __call__
    return await super().__call__(scope, receive, send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/middleware.py", line 26, in __call__
    return await self.inner(scope, receive, send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/routing.py", line 150, in __call__
    return await application(
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/consumer.py", line 94, in app
    return await consumer(scope, receive, send)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/consumer.py", line 44, in __call__
    self.channel_layer = get_channel_layer(self.channel_layer_alias)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/layers.py", line 362, in get_channel_layer
    return channel_layers[alias]
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/layers.py", line 78, in __getitem__
    self.backends[key] = self.make_backend(key)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/layers.py", line 44, in make_backend
    return self._make_backend(name, config)
  File "/home/freduah/VideoCallDesign/learning/env/lib/python3.8/site-packages/channels/layers.py", line 69, in _make_backend
    raise InvalidChannelLayerError(
channels.exceptions.InvalidChannelLayerError: Cannot import BACKEND 'channels_redis.core.RedisChannelLayer' specified for default
WebSocket DISCONNECT /ws/chat/hacking/ [127.0.0.1:41964]

下面是我的设置.py

ASGI_APPLICATION = 'learningDatabase.routing.application'
CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            "hosts": [('127.0.0.1', 6379)],
        },
    }, }

我愿意提供任何你需要的帮助我解决这个问题

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题