我正在尝试按照这里的教程 https://channels.readthedocs.io/en/latest/tutorial/part_2.html并检查通道层是否可以与 Redis 通信。我正在做的唯一不同的事情是我正在使用 docker-compose 并在 docker 容器上运行整个事情,这似乎把一切都搞砸了。这是我尝试时收到的错误消息
run async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/asgiref/sync.py", line 116, in __call__
return call_result.result()
File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 428, in result
return self.__get_result()
File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/local/lib/python3.7/site-packages/asgiref/sync.py", line 156, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/channels_redis/core.py", line 293, in send
async with self.connection(index) as connection:
File "/usr/local/lib/python3.7/site-packages/channels_redis/core.py", line 820, in __aenter__
self.conn = await self.pool.pop() …
Run Code Online (Sandbox Code Playgroud)