我的 Django 应用程序出现以下错误:
redis.exceptions.AuthenticationError: invalid username-password pair
我在settings.py中的配置是:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
#"hosts": [(config('REDIS_HOST'), config('REDIS_PORT', cast=int))],
"hosts": ["redis://:password@localhost:6379/1"],
},
},
}
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://:password@localhost:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
'MAX_ENTRIES' : 15000,
},
"KEY_PREFIX": "example"
}
}
我的缓存配置没有任何问题,但通道的通行证/用户无效!? 两者都使用相同的redis。
尝试对 CHANNEL_LAYERS->default
"CONFIG": {
"hosts": [("<host:str>", <port:int>)],
}