I’m getting a Redis timeout error when trying to use Django Channels WebSocket with Valkey on Arch Linux.
Error:
TimeoutError: Timeout reading from 127.0.0.1:6379
redis.exceptions.TimeoutError: Timeout reading from 127.0.0.1:6379
Setup:
- Arch Linux with Valkey installed and running
- Django 6.0 with channels_redis
- Daphne as ASGI server
- DEBUG = False in production mode (uses RedisChannelLayer)
Traceback:
channels/consumer.py → channels/routing.py → jwt_auth.py → channels/security/websocket.py → Redis connection fails
CHANNEL_LAYERS config:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [os.getenv("REDIS_URL", "redis://localhost:6379/1")],
},
},
}
WebSocket connects and authenticates successfully, but immediately fails with Redis timeout.
Valkey is running (systemctl status valkey shows active). What could be causing this timeout?