-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Description
Config
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.pubsub.RedisPubSubChannelLayer',
'CONFIG': {
"hosts": [('127.0.0.1', 6379)],
},
},
}
Error:
File "[..]lib/python3.10/site-packages/channels/routing.py", line 71, in __call__
return await application(scope, receive, send)
File "[..]lib/python3.10/site-packages/channels/sessions.py", line 47, in __call__
return await self.inner(dict(scope, cookies=cookies), receive, send)
File "[..]lib/python3.10/site-packages/channels/sessions.py", line 263, in __call__
return await self.inner(wrapper.scope, receive, wrapper.send)
File "[..]lib/python3.10/site-packages/channels/auth.py", line 185, in __call__
return await super().__call__(scope, receive, send)
File "[..]lib/python3.10/site-packages/channels/middleware.py", line 26, in __call__
return await self.inner(scope, receive, send)
File "[..]lib/python3.10/site-packages/channels/routing.py", line 150, in __call__
return await application(
File "[..]lib/python3.10/site-packages/channels/consumer.py", line 94, in app
return await consumer(scope, receive, send)
File "[..]lib/python3.10/site-packages/channels/consumer.py", line 46, in __call__
self.channel_name = await self.channel_layer.new_channel()
File "[..]lib/python3.10/site-packages/channels_redis/pubsub.py", line 34, in _async_proxy
return await getattr(layer, name)(*args, **kwargs)
File "[..]lib/python3.10/site-packages/channels_redis/pubsub.py", line 165, in new_channel
await self._subscribe_to_channel(channel)
File "[..]lib/python3.10/site-packages/channels_redis/pubsub.py", line 144, in _subscribe_to_channel
await shard.subscribe(channel)
File "[..]lib/python3.10/site-packages/channels_redis/pubsub.py", line 282, in subscribe
self._ensure_redis()
File "[..]lib/python3.10/site-packages/channels_redis/pubsub.py", line 349, in _ensure_redis
pool = aioredis.ConnectionPool.from_url(self.host["address"])
File "[..]lib/python3.10/site-packages/redis/asyncio/connection.py", line 1400, in from_url
url_options = parse_url(url)
File "[..]lib/python3.10/site-packages/redis/asyncio/connection.py", line 1292, in parse_url
parsed: ParseResult = urlparse(url)
File "/usr/lib/python3.10/urllib/parse.py", line 392, in urlparse
url, scheme, _coerce_result = _coerce_args(url, scheme)
File "/usr/lib/python3.10/urllib/parse.py", line 128, in _coerce_args
return _decode_args(args) + (_encode_result,)
File "/usr/lib/python3.10/urllib/parse.py", line 112, in _decode_args
return tuple(x.decode(encoding, errors) if x else '' for x in args)
File "/usr/lib/python3.10/urllib/parse.py", line 112, in <genexpr>
return tuple(x.decode(encoding, errors) if x else '' for x in args)
AttributeError: 'tuple' object has no attribute 'decode'
Offending commit (presumably): 65a0528
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Fix docs to reflect that tuples don't work
bbrowning918 commentedon Oct 24, 2022
Oh, I likely missed the pubsub layer when I reverted the connection bits, the tuple style works for the non-pubsub versions as it just gets unpacked and sent through to
redis-py
.address
is the only reserved kwarg for using a connection URL which was kept/named for what I assume is historical reasons.Something to the effect of:
At https://github.com/django/channels_redis/blob/main/channels_redis/pubsub.py#L349 would bring back the tuple functionality
vanschelven commentedon Oct 25, 2022
which is a bit weird in itself (to me), e.g. because
password
is now ignored.Refactor redis connection utilities of pubsub and core layers (django…
Refactor redis connection utilities of pubsub and core layers (django…