cri_intranet.custom_storage module

class cri_intranet.custom_storage.PhotoStorage(*args, **kwargs)[source]

Bases: storages.backends.s3boto3.S3Boto3Storage

bucket_name = 'cri-intranet-photos'
class cri_intranet.custom_storage.PublicS3Storage(*args, **kwargs)[source]

Bases: storages.backends.s3boto3.S3Boto3Storage

This class is a S3 django-storages class. It adds a custom domain setting to the default S3 storage class. This is useful because django-storages does not sign object URLs when a custom_domain is set, thus saving us a lot of overhead. We don’t want that to be the default behavior so we add a custom setting name.

It is necessary to add the AWS_PUBLIC_CUSTOM_DOMAIN setting.

custom_domain = None
object_parameters = {'ACL': 'public-read'}