etianen / django-s3-storage

Django Amazon S3 file storage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to access bucket subfolders?

betancourtl opened this issue · comments

commented

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'

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 👍