mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-29 17:14:42 +00:00
Simplify IMAGEKIT_CACHE_BACKEND setting
This commit is contained in:
parent
436a73dc9a
commit
667f0cc08e
2 changed files with 7 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from appconf import AppConf
|
||||
from django.conf import settings
|
||||
from .imagecache.actions import validate_now, clear_now
|
||||
|
||||
|
||||
|
|
@ -8,3 +9,8 @@ class ImageKitConf(AppConf):
|
|||
CACHE_DIR = 'CACHE/images'
|
||||
CACHE_PREFIX = 'ik-'
|
||||
DEFAULT_IMAGE_CACHE_STRATEGY = 'imagekit.imagecache.strategies.Pessimistic'
|
||||
|
||||
def configure_cache_backend(self, value):
|
||||
if value is None:
|
||||
value = 'django.core.cache.backends.dummy.DummyCache' if settings.DEBUG else 'default'
|
||||
return value
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
from ..utils import get_singleton
|
||||
from django.core.cache import get_cache
|
||||
from django.core.cache.backends.dummy import DummyCache
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
|
|
@ -23,8 +22,7 @@ class CachedValidationBackend(object):
|
|||
def cache(self):
|
||||
if not getattr(self, '_cache', None):
|
||||
from django.conf import settings
|
||||
alias = settings.IMAGEKIT_CACHE_BACKEND
|
||||
self._cache = get_cache(alias) if alias else DummyCache(None, {})
|
||||
self._cache = get_cache(settings.IMAGEKIT_CACHE_BACKEND)
|
||||
return self._cache
|
||||
|
||||
def get_key(self, file):
|
||||
|
|
|
|||
Loading…
Reference in a new issue