{"id":44762,"library":"django-sendfile2","title":"django-sendfile2","description":"Abstraction to offload file uploads to web-server (e.g. Apache with mod_xsendfile) once Django has checked permissions etc. Current version 0.7.2, maintenance mode.","status":"maintenance","version":"0.7.2","language":"python","source_language":"en","source_url":"https://github.com/johnsensible/django-sendfile2","tags":["django","sendfile","file-upload","x-sendfile"],"install":[{"cmd":"pip install django-sendfile2","lang":"bash","label":"pip install"}],"dependencies":[],"imports":[{"wrong":"from sendfile import sendfile","symbol":"sendfile","correct":"from django_sendfile import sendfile"}],"quickstart":{"code":"from django.http import HttpResponse\nfrom sendfile import sendfile\n\ndef download_view(request, filepath):\n    # filepath is absolute path to file\n    return sendfile(request, filepath, attachment=True, attachment_filename='report.pdf')","lang":"python","description":"Basic usage to serve a file with x-sendfile header."},"warnings":[{"fix":"Use 'from sendfile import sendfile'","message":"Import is from sendfile, not from django-sendfile2. The package name on PyPI is django-sendfile2, but the module is sendfile.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure filepath starts with '/' and is within the SENDFILE_ROOT setting","message":"The filepath must be an absolute path on the filesystem. Relative paths or paths outside the allowed root will raise SuspiciousFileOperation.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'content_type' instead of 'mimetype'","message":"The 'sendfile' function in version 0.4.0 changed signature; 'mimetype' parameter replaced by 'content_type'. Old code using 'mimetype' may break.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Use a production backend like 'sendfile.backends.xsendfile' for Apache or 'sendfile.backends.nginx' for nginx","message":"The library does not support streaming or large files if SENDFILE_BACKEND is set to 'simple' (Django dev server). It reads the entire file into memory.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.7.2':26 'abstract':4 'apach':14 'check':21 'current':24 'django':2,19,29 'django-sendfile2':1 'e.g':13 'etc':23 'file':7,32 'file-upload':31 'mainten':27 'mod':16 'mode':28 'offload':6 'permiss':22 'sendfil':30,36 'sendfile2':3 'server':12 'upload':8,33 'version':25 'web':11 'web-serv':10 'x':35 'x-sendfil':34 'xsendfil':17","created_at":"2026-06-07T12:51:43.038803+00:00","updated_at":"2026-06-07T12:51:43.038803+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://codeberg.org/moggers87/django-sendfile2","github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}