Question

I am using django-storages backend and I have previously not used Amazon S3. I have migrated to Amazon S3 by uploading the files via Firefox's S3 Manager.

THe problem is, with this code:

<a href="{{ MEDIA_URL }}{{ g.photo }}" class="lightbox" title="{{ g.description }}">
    {%  thumbnail g.photo '95x95' crop="center" as im %}
        <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />
    {% endthumbnail %}
</a>

The request generated does not include the required params in the GET request, like the Signature. However, the sorl-generated thumbnails work!

Is there something I'm missing with regards to uploading my files in S3? Is there additional code to be added in the href? Why is sorl able to retrieve the files and create a thumbnail out of it?

Was it helpful?

Solution

The file is not accessible publicly. This may have happened on uploading or due bucket restrictions.

You could either change the ACL settings in S3 Manager for this file to public access (if only this file should be publicly readable), or create a Bucket policy for fine-grained permissions on the bucket - you can do that in the AWS Console.

If any file in the bucket shall be public, you should change the default ACL setting in your S3 client accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top