Allow overriding ProductionStorage and ProductionS3Storage kwargs with a django settings value

This commit is contained in:
Calen Pennington
2020-01-03 12:14:02 -05:00
parent e654036d54
commit e11e9d9073
3 changed files with 6 additions and 1 deletions

View File

@@ -935,6 +935,7 @@ PIPELINE = {
}
STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
STATICFILES_STORAGE_KWARGS = {}
# List of finder classes that know how to find static files in various locations.
# Note: the pipeline finder is included to be able to discover optimized files

View File

@@ -1548,6 +1548,7 @@ PIPELINE = {
}
STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
STATICFILES_STORAGE_KWARGS = {}
# List of finder classes that know how to find static files in various locations.
# Note: the pipeline finder is included to be able to discover optimized files

View File

@@ -3,6 +3,7 @@ Django storage backends for Open edX.
"""
from django.conf import settings
from django.contrib.staticfiles.storage import StaticFilesStorage
from django.core.files.storage import get_storage_class, FileSystemStorage
from django.utils.deconstruct import deconstructible
@@ -51,7 +52,9 @@ class ProductionMixin(
can be applied over an existing Storage.
We use this version on production.
"""
pass
def __init__(self, *args, **kwargs):
kwargs.update(settings.STATICFILES_STORAGE_KWARGS.get(settings.STATICFILES_STORAGE, {}))
super(ProductionMixin, self).__init__(*args, **kwargs)
class ProductionStorage(ProductionMixin, StaticFilesStorage):