Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Protecting static files in your web app

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for Max Ludwig Max Ludwig
January 02, 2016

Protecting static files in your web app

Avatar for Max Ludwig

Max Ludwig

January 02, 2016

Other Decks in Programming

Transcript

  1. from django.http import HttpResponse from django.utils.encoding import smart_str def sendfile(request,

    filename, **kwargs): # check requesting user’s permissions response = HttpResponse() response['X-Sendfile'] = smart_str(unicode(filename)) return response django-sendfile/sendfile/backends/xsendfile.py