Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

COMPRESS_STORAGE and S3 #327

Open
gtaylor opened this Issue Oct 18, 2012 · 1 comment

Comments

Projects
None yet
3 participants

gtaylor commented Oct 18, 2012

I'm still trying to find the best way around this, but am hoping you've got some better ideas. The problem is that django-storages S3 backend pulls a bucket name from AWS_STORAGE_BUCKET_NAME by default. This is great, except when you're already using another app that follows the same assumption.

I'm using the S3Boto storage backend for my default file storage backend. So in this case, let's say my AWS_STORAGE_BUCKET_NAME value is 'my-bucket'. This ends up being where all my user-uploaded media goes.

I then install django-compressor, and set the same backend (S3Boto). We now upload to the same bucket that my user-uploaded media is in. Definitely not what I was wanting.

I understand this is somewhat of a django-storages ordeal than your own, but wanted to see if you had any ideas. I'll probably just end up sub-classing S3Boto and setting a bucket name in the sub-class. Seems kind of meh, but I'll get over it if that's the only way.

zachsnow commented Dec 6, 2012

I ended up going that route as well; something like this:

class SomeStorage(S3BotoStorage):
    def __init__(self, *args, **kwargs):
        bucket = settings.SOME_BUCKET_NAME
        super(CompressStorage, self).__init__(bucket=bucket, *args, **kwargs)

@diox diox added the deployment label Sep 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment