Updated cache to not use get_storage_class
This commit is contained in:
parent
f134df3384
commit
9903bb0088
@ -1,2 +1,2 @@
|
|||||||
__version__ = '0.2.3'
|
__version__ = '0.2.4'
|
||||||
default_app_config = 'byostorage.apps.BYOStorageConfig'
|
default_app_config = 'byostorage.apps.BYOStorageConfig'
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
from django.core.files.storage import Storage, get_storage_class
|
from django.core.files.storage import Storage, DefaultStorage
|
||||||
from django.utils.deconstruct import deconstructible
|
from django.utils.deconstruct import deconstructible
|
||||||
|
from django.utils.module_loading import import_string
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
import os.path
|
import os.path
|
||||||
@ -15,14 +16,14 @@ class CachedStorage(Storage):
|
|||||||
|
|
||||||
def __init__(self, remote=None, cachedir=None, expires=600):
|
def __init__(self, remote=None, cachedir=None, expires=600):
|
||||||
if not remote:
|
if not remote:
|
||||||
remote = getattr(settings, 'CACHED_STORAGE_REMOTE', None)
|
remote = getattr(settings, 'CACHED_STORAGE_REMOTE', DefaultStorage)
|
||||||
if not cachedir:
|
if not cachedir:
|
||||||
cachedir = getattr(settings, 'CACHED_STORAGE_DIR', 'cache')
|
cachedir = getattr(settings, 'CACHED_STORAGE_DIR', 'cache')
|
||||||
|
|
||||||
if isinstance(remote, Storage):
|
if isinstance(remote, Storage):
|
||||||
self.remote = remote
|
self.remote = remote
|
||||||
else:
|
else:
|
||||||
self.remote = get_storage_class(remote)()
|
self.remote = import_string(remote)()
|
||||||
self.cachedir = cachedir
|
self.cachedir = cachedir
|
||||||
self.expires = expires
|
self.expires = expires
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user