diff --git a/storages/backends/s3boto3.py b/storages/backends/s3boto3.py index cf3e8997..f1d4e1c3 100644 --- a/storages/backends/s3boto3.py +++ b/storages/backends/s3boto3.py @@ -257,6 +257,9 @@ class S3Boto3Storage(CompressStorageMixin, BaseStorage): config = None def __init__(self, **settings): + cloudfront_key_id = settings.pop("cloudfront_key_id", None) + cloudfront_key = settings.pop("cloudfront_key", None) + super().__init__(**settings) check_location(self) @@ -281,6 +284,9 @@ def __init__(self, **settings): if self.transfer_config is None: self.transfer_config = TransferConfig(use_threads=self.use_threads) + if cloudfront_key_id and cloudfront_key: + self.cloudfront_signer = self.get_cloudfront_signer(cloudfront_key_id, cloudfront_key) + def get_cloudfront_signer(self, key_id, key): return _cloud_front_signer_from_pem(key_id, key)