channely层和redis之间的通信错误

nhjlsmyf  于 2021-06-10  发布在  Redis
关注(0)|答案(0)|浏览(234)

我在linux中安装了redis版本6.0.6
我正在django频道上学习本教程,并运行了以下代码:

>>> import channels.layers
>>> channel_layer = channels.layers.get_channel_layer()
>>> from asgiref.sync import async_to_sync
>>> async_to_sync(channel_layer.send)('test_channel',{'type':'hello'})
>>> async_to_sync(channel_layer.receive)('test_channel')

我犯了这样的错误

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/peacekim/chat/venv/lib/python3.6/site-packages/asgiref/sync.py", line 139, in __call__
    return call_result.result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/peacekim/chat/venv/lib/python3.6/site-packages/asgiref/sync.py", line 204, in main_wrap
    result = await self.awaitable(*args,**kwargs)
  File "/home/peacekim/chat/venv/lib/python3.6/site-packages/channels_redis/core.py", line 485, in receive
    return (await self.receive_single(channel))[1]
  File "/home/peacekim/chat/venv/lib/python3.6/site-packages/channels_redis/core.py", line 508, in receive_single
    index, channel_key, timeout=self.brpop_timeout
  File "/home/peacekim/chat/venv/lib/python3.6/site-packages/channels_redis/core.py", line 345, in _brpop_with_clean
    result = await connection.bzpopmin(channel, timeout=timeout)
aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'

我怎样才能解决这个错误。请。。。

暂无答案!

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

相关问题