mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-29 09:14:41 +00:00
Add DEFAULT_FILE_STORAGE Setting; Closes #153
This commit is contained in:
parent
ca1db05c4e
commit
98a6fff62d
2 changed files with 5 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ class ImageKitConf(AppConf):
|
|||
CACHE_DIR = 'CACHE/images'
|
||||
CACHE_PREFIX = 'imagekit:'
|
||||
DEFAULT_IMAGE_CACHE_STRATEGY = 'imagekit.imagecache.strategies.JustInTime'
|
||||
DEFAULT_FILE_STORAGE = None # Indicates that the source storage should be used
|
||||
|
||||
def configure_cache_backend(self, value):
|
||||
if value is None:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from django.utils.encoding import smart_str, smart_unicode
|
|||
import os
|
||||
from .signals import before_access
|
||||
from .utils import (suggest_extension, format_to_mimetype,
|
||||
extension_to_mimetype, get_logger)
|
||||
extension_to_mimetype, get_logger, get_singleton)
|
||||
|
||||
|
||||
class BaseIKFile(File):
|
||||
|
|
@ -72,7 +72,9 @@ class BaseIKFile(File):
|
|||
|
||||
class ImageSpecCacheFile(BaseIKFile, ImageFile):
|
||||
def __init__(self, spec, source_file):
|
||||
storage = spec.storage or source_file.storage
|
||||
storage = (spec.storage or
|
||||
get_singleton(settings.IMAGEKIT_DEFAULT_FILE_STORAGE, 'file storage backend') if settings.IMAGEKIT_DEFAULT_FILE_STORAGE
|
||||
else source_file.storage)
|
||||
super(ImageSpecCacheFile, self).__init__(storage=storage)
|
||||
self.spec = spec
|
||||
self.source_file = source_file
|
||||
|
|
|
|||
Loading…
Reference in a new issue