mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-05-01 01:54:41 +00:00
Work a compatibility implementation for Django 1.2
This commit is contained in:
parent
6fabad9749
commit
97dc4b6cb2
1 changed files with 13 additions and 2 deletions
|
|
@ -23,10 +23,21 @@ class ImageKitConf(AppConf):
|
|||
except ImportError:
|
||||
default_cache_alias = 'default'
|
||||
|
||||
if default_cache_alias in getattr(settings, 'CACHES', {}):
|
||||
caches = getattr(settings, 'CACHES', None)
|
||||
if caches is None:
|
||||
# Support Django<=1.2 there is no default `CACHES` setting
|
||||
try:
|
||||
from django.core.cache.backends.dummy import DummyCache
|
||||
except ImportError:
|
||||
dummy_cache = 'dummy://'
|
||||
else:
|
||||
dummy_cache = 'django.core.cache.backends.dummy.DummyCache'
|
||||
return dummy_cache
|
||||
|
||||
if default_cache_alias in caches:
|
||||
value = default_cache_alias
|
||||
else:
|
||||
raise ValueError("The default cache alias '%s' is not available in CACHES" % value)
|
||||
raise ValueError("The default cache alias '%s' is not available in CACHES" % default_cache_alias)
|
||||
|
||||
return value
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue