XsendFile with apache and django

Also make sure to set the XSendFilePath in your Apache configuration file like so,

XSendFile on
XSendFilePath "//path/to/files/on/disk"
<Directory "//path/to/files/on/disk">
    Order Deny,Allow
    Allow from all
</Directory>

and include this in your view while returning the response:

response['X-Sendfile'] = smart_str(file_path)

And to answer your questions:

  • Activate the XSendFile in the vhost tag
  • I've written above what else needs to be done in the view
  • I'm not sure if you should remove the media alias, the log files should tell you if having them is a problem