scratchpad

Secure Storage in Django

This isn't a huge amount of code but I spent quite a bit of time trying to get nginx to behave.


Makes Django storage URLs expire after a set amount of time. Built to be used with nginx's secure_link module, essentially emulating Amazon's S3's similar functionality. Because it's a mixin, you can theoretically use it with any Django storage method, but it will only limit access if there's a properly configured nginx server actually serving the files. SecureFileSystemStorage is included, but again, you can use any base Storage class you want.

Required modules:

  • Django (this was built for 1.6)
  • secret_hash.py (https://gist.github.com/wizpig64/7314191)