'Not Implemented Error in Django Channels Layers
I was following the Django channels tutorial to create a simple chat application. But while trying to check if the channel layer can connect to Redis, I get this Not Implemented Error.
>>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\asgiref\sync.py", line 204, in __call__
return call_result.result()
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 439, in result
return self.__get_result()
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
raise self._exception
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\asgiref\sync.py", line 270, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\channels_redis\core.py", line 343, in send
async with self.connection(index) as connection:
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\channels_redis\core.py", line 902, in __aenter__
self.conn = await self.pool.pop()
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\channels_redis\core.py", line 93, in pop
conn = await self.create_conn(loop)
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\channels_redis\core.py", line 79, in create_conn
return await aioredis.create_redis_pool(**kwargs)
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\aioredis\commands\__init__.py", line 188, in create_redis_pool
pool = await create_pool(address, db=db,
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\aioredis\pool.py", line 58, in create_pool
await pool._fill_free(override_min=False)
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\aioredis\pool.py", line 383, in _fill_free
conn = await self._create_new_connection(self._address)
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\aioredis\connection.py", line 121, in create_connection
reader, writer = await asyncio.wait_for(open_unix_connection(
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 408, in wait_for
return await fut
File "D:\Web Development\DJANGO\Channels\venv\lib\site-packages\aioredis\stream.py", line 39, in open_unix_connection
transport, _ = await get_event_loop().create_unix_connection(
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 387, in create_unix_connection
raise NotImplementedError
NotImplementedError
Channel_Layers configuration:
ASGI_APPLICATION = 'justchat.asgi.application'
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
'hosts': [('redis://127.0.0.1, 6379')]
},
},
}
Redis Server is running: Redis Server
I have been following this tutorial since the start and my code is same as it is there. What should I do?
Solution 1:[1]
There is a typo in the configuration:
'hosts': [('redis://127.0.0.1, 6379')]
should be like:
'hosts': [('localhost', 6379)]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Razenstein |
