【发布时间】:2022-11-25 12:24:26
【问题描述】:
我在 Django 中使用 django-redis 添加 Azure redis 缓存,但我遇到了连接问题,我添加了密钥密码和主机名以及端口,但没有成功,我收到此错误:
django_redis.exceptions.ConnectionInterrupted: Redis ConnectionError: Error while reading from myhostname.net:6380 : (104, 'Connection reset by peer')
我尝试阅读现有的答案但没有运气。
这是我在 Django settings.py 中的内容:
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": os.getenv('REDIS_URL'),
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
'SSL': True,
"PASSWORD": os.getenv('REDIS_PASSWORD'),
}
}
}
REDIS_URL 是这样的:
REDIS_URL=rediss://myhostname.net:6380
以及REDIS_PASSWORD提供的密码。
我可能遗漏了什么,我正在 Digitalocean 上测试它,我激活了 SSL。
【问题讨论】:
标签: django redis digital-ocean azure-redis-cache