jazzband / django-redis

Full featured redis cache backend for Django.
Other
2.87k stars 432 forks source link

Connection Closed by Server Errors #593

Open rishindoshi opened 2 years ago

rishindoshi commented 2 years ago

Hey everyone hope you're doing well!

I have a Django application on v3.2.11 and I'm trying to hook it up to a redis cache using this package. Testing the application with a local instance of redis works perfectly, but when trying to connect to a remote redis instance I have hosted on Digital Ocean, I keep getting the "Connection close by server" error.

My settings.py cache config is set up as follows:

CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        'LOCATION': (
            'redis://<user>:<password>'
            '@discz-staging-redis-do-user-10516625-0.b.db.ondigitalocean.com:25061'
        ),
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        }
    }
}

Another thing of note is that I'm able to connect to the remote redis instance via redis-cli, but only if I add the --tls option. If I don't run it with --tls, then I get the same "Connection closed by server" error on the command line.

Any help on this would be much appreciated!

WisdomPill commented 2 years ago

Hello, sorry for the late reply.

Were you able to connect using plain redis-py?

I know this is a recurring subject with django-redis and perhaps some more documentation should be written about it.

I invite you to have a look here #497 and in case open a PR for pointing this out in the documentation