From fbf15befb86da577c0bfa3c1794b01947f117208 Mon Sep 17 00:00:00 2001 From: Pierre Dulac Date: Thu, 29 Oct 2015 23:27:02 +0100 Subject: [PATCH] Do not take a decision on which cache to use in DEBUG mode maybe the developer wants to test his cache configuration locally, or maybe he has to test different types of caches, we just don't know --- imagekit/conf.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/imagekit/conf.py b/imagekit/conf.py index 2900da1..4485eb1 100644 --- a/imagekit/conf.py +++ b/imagekit/conf.py @@ -17,25 +17,16 @@ class ImageKitConf(AppConf): def configure_cache_backend(self, value): if value is None: - try: - from django.core.cache.backends.dummy import DummyCache - except ImportError: - dummy_cache = 'dummy://' - else: - dummy_cache = 'django.core.cache.backends.dummy.DummyCache' - # DEFAULT_CACHE_ALIAS doesn't exist in Django<=1.2 try: from django.core.cache import DEFAULT_CACHE_ALIAS as default_cache_alias except ImportError: default_cache_alias = 'default' - if settings.DEBUG: - value = dummy_cache - elif default_cache_alias in getattr(settings, 'CACHES', {}): + if default_cache_alias in getattr(settings, 'CACHES', {}): value = default_cache_alias else: - value = getattr(settings, 'CACHE_BACKEND', None) or dummy_cache + raise ValueError("The default cache alias '%s' is not available in CACHES" % value) return value