Login

Tag "xsendfile"

Snippet List

Apache X-sendfile with permissions checking

This allows the mod_xsendfile module for Apache safely serving private files. Django take cake about processing and permissions checking, Apache server requested files. Installation of mod_xsendfile: $ tar -xzvf mod_xsendfile-0.12.tar.gz $ /usr/sbin/apxs -c mod_xsendfile-0.12/mod_xsendfile.c $ ld -Bshareable -o mod_xsendfile-0.12/mod_xsendfile.so mod_xsendfile-0.12/mod_xsendfile.o Copy mod_xsendfile.so to your local Apache modules folder. Modify httpd.conf to load an enable the module: LoadModule xsendfile_module modules/mod_xsendfile.so Add to virtual host container: <Virtual ...:80> XSendFile On XSendFilePath /home/django_projects/mysite/media/ </Virtual>

  • http
  • media
  • static
  • xsendfile
Read More

X-Sendfile static file serve view

This view has the same functionality as Django's builtin static view function but when the configuration option `USE_XSENDFILE = True` is specified in the settings it returns the absolute path of the file instead of its contents. This allows the mod_xsendfile module in Apache or Lighttpd to take care of efficiently serving the file while still allowing for Django to take care of other processing of the request, like access control or counting the amount of downloads.

  • static
  • xsendfile
Read More

2 snippets posted so far.