0

I have multiple apps and each app has different cachecontrol requirement. get_object_parameters provides us. But it will be big change for codebase. Instead is it possible to pass cachecontrol to constructor e.g

S3Boto3Storage(**options = {
            'bucket_name': 'abc',
            'querystring_expire': 172800,
            'cachecontro': 'max-age=12000',
            'location': 'LINTING',
})

Right now its not working need to add this functionality in package.

1 Answer 1

0

You have to use a new Custom class that inherits S3Boto3Storage

from storages.backends.s3boto3 import S3Boto3Storage

class CustomS3Boto3Storage(S3Boto3Storage):
    def __init__(self, *args, **kwargs):
        cachecontrol = kwargs.pop('cachecontrol', None)
        super().__init__(*args, **kwargs)
        self.default_cache_control = cachecontrol

# Usage
storage = CustomS3Boto3Storage(
    bucket_name='abc',
    querystring_expire=172800,
    cachecontrol='max-age=12000',
    location='LINTING'
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.