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

Protecting static files in your web app

Max Ludwig
January 02, 2016

Protecting static files in your web app

Max Ludwig

January 02, 2016
Tweet

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