generated from Code-Institute-Org/gitpod-full-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom_storages.py
25 lines (19 loc) · 845 Bytes
/
custom_storages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from django.conf import settings
from storages.backends.s3boto3 import S3Boto3Storage
# CREDIT [3]
# subclassing and overriding attribute names
class StaticStorage(S3Boto3Storage):
location = settings.STATICFILES_LOCATION
bucket_name = settings.AWS_STORAGE_PUBLIC_BUCKET_NAME
custom_domain = settings.AWS_S3_CUSTOM_PUBLIC_DOMAIN
file_overwrite = True
class PublicFileStorage(S3Boto3Storage):
location = settings.MEDIAFILES_PUBLIC_LOCATION
bucket_name = settings.AWS_STORAGE_PUBLIC_BUCKET_NAME
custom_domain = settings.AWS_S3_CUSTOM_PUBLIC_DOMAIN
file_overwrite = False
class PrivateFileStorage(S3Boto3Storage):
location = settings.MEDIAFILES_PRIVATE_LOCATION
bucket_name = settings.AWS_STORAGE_PRIVATE_BUCKET_NAME
custom_domain = settings.AWS_S3_CUSTOM_PRIVATE_DOMAIN
file_overwrite = False