django-s3-storage
django-s3-storage copied to clipboard
How to access bucket subfolders?
How can I set the location of the static files? I've done this before when using django-storages
but I'm not sure how it works with this package.
This is how I have been able to set this up using django-storages
class MediaStorage(S3Boto3Storage):
bucket_name = 'my-app-bucket'
location = 'media'
class StaticStorage(S3Boto3Storage):
bucket_name = 'my-app-bucket'
location = 'static'
The AWS_S3_KEY_PREFIX setting (suffixed with _STATIC if necessary), is what you want.
On Fri, 22 May 2020 at 16:01, Luis [email protected] wrote:
How can I set the location of the static files? I've done this before when using django-storages but I'm not sure how it works with this package.
class MediaStorage(S3Boto3Storage): bucket_name = 'my-app-bucket' location = 'media' class StaticStorage(S3Boto3Storage): bucket_name = 'my-app-bucket' location = 'static'
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-s3-storage/issues/109, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEKCBVK464A27I4VLVKKLRS2HVHANCNFSM4NH3M5RA .
I had exactly the same question. The following does the trick.
AWS_S3_KEY_PREFIX = 'media' AWS_S3_KEY_PREFIX_STATIC = 'static'
@etianen: Thanks for the work on django-s3-storage. Works really well 👍