epicserve / django-cache-url

Use Cache URLs in your Django Application
MIT License
18 stars 12 forks source link

Wrong Redis backend name with Django 4.2 #31

Closed Real-Gecko closed 6 months ago

Real-Gecko commented 6 months ago

After upgrading to Django 4.2 backend name for Redis is incorrect. I've created a sample project with:

CACHES = {"default": {**django_cache_url.config(default="rediss://localhost:6379")}}

When I run shell and inspect settings I get different results for different Django versions:

django 3.2:

>>> settings.CACHES
{'default': {'BACKEND': 'django_redis.cache.RedisCache', 'LOCATION': 'rediss://loca
lhost:6379/0'}}

django 4.2:

>>> settings.CACHES
{'default': {'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 
'rediss://localhost:6379/0'}}
Real-Gecko commented 6 months ago

Sample project https://github.com/Real-Gecko/django-cache-url-issuse-31

epicserve commented 6 months ago

That's the correct behavior and is intensional. If you're using Django >= 4, you don't need this library, but if you are still using it, it returns the built-in backend as designed.

Real-Gecko commented 6 months ago

Thanks for advice!