el valor por defecto o f configuración sorl THUMBNAIL_STORAGE es la misma configuración.DEFAULT_FILE_STORAGE.
Debe crear almacenamiento que utiliza STATIC_ROOT, por ejemplo, puede usar 'django.core.files.storage.FileSystemStorage' y cree una instancia con ubicación = settings.STATIC_ROOT y base_url = settings.STATIC_URL
Solo THUMBNAIL_STORAGE establecido en la configuración de un 'MyCustomFileStorage' no funcionó. Así que tuve que hacer para DEFAULT_FILE_STORAGE y funcionó.
Definir en settings.py:
DEFAULT_FILE_STORAGE = 'utils.storage.StaticFilesStorage'
utils/almacenamiento.PY:
import os
from datetime import datetime
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.core.exceptions import ImproperlyConfigured
def check_settings():
"""
Checks if the MEDIA_(ROOT|URL) and STATIC_(ROOT|URL)
settings have the same value.
"""
if settings.MEDIA_URL == settings.STATIC_URL:
raise ImproperlyConfigured("The MEDIA_URL and STATIC_URL "
"settings must have different values")
if (settings.MEDIA_ROOT == settings.STATIC_ROOT):
raise ImproperlyConfigured("The MEDIA_ROOT and STATIC_ROOT "
"settings must have different values")
class TimeAwareFileSystemStorage(FileSystemStorage):
def accessed_time(self, name):
return datetime.fromtimestamp(os.path.getatime(self.path(name)))
def created_time(self, name):
return datetime.fromtimestamp(os.path.getctime(self.path(name)))
def modified_time(self, name):
return datetime.fromtimestamp(os.path.getmtime(self.path(name)))
class StaticFilesStorage(TimeAwareFileSystemStorage):
"""
Standard file system storage for static files.
The defaults for ``location`` and ``base_url`` are
``STATIC_ROOT`` and ``STATIC_URL``.
"""
def __init__(self, location=None, base_url=None, *args, **kwargs):
if location is None:
location = settings.STATIC_ROOT
if base_url is None:
base_url = settings.STATIC_URL
if not location:
raise ImproperlyConfigured("You're using the staticfiles app "
"without having set the STATIC_ROOT setting. Set it to "
"the absolute path of the directory that holds static files.")
# check for None since we might use a root URL (``/``)
if base_url is None:
raise ImproperlyConfigured("You're using the staticfiles app "
"without having set the STATIC_URL setting. Set it to "
"URL that handles the files served from STATIC_ROOT.")
if settings.DEBUG:
check_settings()
super(StaticFilesStorage, self).__init__(location, base_url, *args, **kwargs)
Referencia:
https://github.com/mneuhaus/heinzel/blob/master/staticfiles/storage.py
https://docs.djangoproject.com/en/dev/ref/settings/#default-file-storage
Mikko Hellsing (desarrollador SORL-miniatura) dijo que tenía que instatiate SORL-miniatura con un base_url, pero no he podido para encontrar cualquier documentación sobre cómo hacer eso. – DarwinSurvivor