-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Feature request: support default redis backend #356
Comments
TIL while writing tests that CACHES = {
'default': env.cache_url('REDIS_URL', backend='django.core.cache.backends.redis.RedisCache')
} Also looking through the tests, I realise supporting Django 4 is not something this package currently does, and there would be copious test changes to ensure Django 4 support in the first place. For reference, here is the base code I suggest. This based on the logic that it should detect for a package before detecting for a Django version, being installing a package is an active choice on the user's part. # environ/compat.py
# back compatibility with redis_cache package
if find_loader('redis_cache'):
REDIS_DRIVER = 'redis_cache.RedisCache'
# default to built-in redis backend if available
elif DJANGO_VERSION is not None and DJANGO_VERSION < (4, 0):
REDIS_DRIVER='django.core.cache.backends.redis.RedisCache'
else:
REDIS_DRIVER = 'django_redis.cache.RedisCache' |
It may also make sense to use a new scheme for the core redis, much like how there's |
good job, any chance to create a Pull-Request for this? |
Implemented in #397. Thank you for contributing! |
As of Django 4.0, there is now core support for the redis backend.
Currently,
django-environ
detects uses package inspection to work out which redis backend to use (in environ/compat.py), which usesredis_cache
if detected, or it defaults todjango_redis
.I think this package should default to using the core backend if using Django 4.0 or above/
(I am working on this in a branch on my fork. Pull Request shortly.)
The text was updated successfully, but these errors were encountered: