25👍
✅
The cleanest way for you would be to create a subclass of S3BotoStorage, and override default bucket name in the init method.
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
class MyS3Storage(S3BotoStorage):
def __init__(self, *args, **kwargs):
kwargs['bucket'] = getattr(settings, 'MY_AWS_STORAGE_BUCKET_NAME')
super(MyS3Storage, self).__init__(*args, **kwargs)
Then specify this class as your DEFAULT_FILE_STORAGE
and leave STATICFILES_STORAGE
as it is, or vise versa.
Source:stackexchange.com