Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass REDIS connection as an URL to django-redis-session #3717

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

noliveleger
Copy link
Contributor

@bufke said:

SESSION_REDIS is being set to

{'BACKEND': 'django_redis.cache.RedisCache', 'LOCATION': 'redis://:xxxxxx@redis-cache.kobo.private:6380/2'}

which is right for built in django things...but not django-redis-sessions. It wants {'host': 'host', 'port': '6379', 'db': '1', 'password': '', 'prefix': 'session', 'socket_timeout': 1}

django_environ_redis_dict = env.cache_url(
'REDIS_SESSION_URL', default='redis://redis_cache:6380/2'
)
django_environ_redis_dict['url'] = django_environ_redis_dict['LOCATION']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This retains the LOCATION and ENGINE in the dict which aren't used by SESSION_REDIS. If for some reason there was ever a collision of values, it could introduce expected errors. I'd prefer to make a new dict instead of merging.

@bufke bufke merged commit 5777cae into beta Mar 9, 2022
@noliveleger noliveleger deleted the fix-session-redis-url branch March 9, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants