Overview

How to store stuff on S3 and make it as secret as possible without authentication

Use S3 expiring signed URL's!

Overwrite the S3Storage class provided in django-storages to make sure things are protected.

Provide a URL and view to easily dish out the secret URL's to authenticated users. Sort of like NGINX X-Accel-Redirect but using S3.

You should not have to change this to the default store. Keep it backends.s3.S3Storage.

Example

models.py

from protected_s3.storage import S3ProtectedStorage

class Photo(models.Model):
photo = models.ImageField(upload_to='photos/', storage=S3ProtectedStorage())

template

{% url s3_download photo.photo %}