{"id":15792839,"url":"https://github.com/sideffect0/django-fileprovider","last_synced_at":"2025-04-01T16:31:03.140Z","repository":{"id":55636844,"uuid":"79189895","full_name":"sideffect0/django-fileprovider","owner":"sideffect0","description":"protected/large media file handler for django ( nginx, apache, caddy ) with development server support (python)","archived":false,"fork":false,"pushed_at":"2020-12-16T09:51:39.000Z","size":23,"stargazers_count":13,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T23:19:09.227Z","etag":null,"topics":["apache","caddy","caddyserver","django","hiawatha","lighthttpd","nginx","python","sendfile"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sideffect0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-17T04:55:41.000Z","updated_at":"2024-06-25T17:28:41.000Z","dependencies_parsed_at":"2022-08-15T05:10:17.978Z","dependency_job_id":null,"html_url":"https://github.com/sideffect0/django-fileprovider","commit_stats":null,"previous_names":["instapk/django-fileprovider"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sideffect0%2Fdjango-fileprovider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sideffect0%2Fdjango-fileprovider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sideffect0%2Fdjango-fileprovider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sideffect0%2Fdjango-fileprovider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sideffect0","download_url":"https://codeload.github.com/sideffect0/django-fileprovider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246620631,"owners_count":20806809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","caddy","caddyserver","django","hiawatha","lighthttpd","nginx","python","sendfile"],"created_at":"2024-10-04T23:05:19.275Z","updated_at":"2025-04-01T16:31:02.864Z","avatar_url":"https://github.com/sideffect0.png","language":"Python","readme":"[![Downloads](https://pypip.in/download/django-fileprovider/badge.svg)](https://pypi.python.org/pypi/django-fileprovider/)\n\nFile handler for django, useful when you want to add control or logic to served files.  \nIt uses `sendfile` API supports on different servers and uses pythonic solution on django development server.  \nCurrently it supports,  \n\n* Apache  \n* Nginx  \n* LightHttpd  \n* Caddy  \n* Proxygen   \n* H2O/Reproxy  \n* Hiawatha  \n\n# INSTALLATION  \n\n  use pip to install package:  \n  `pip install django-fileprovider`  \n\n   NOTE: if you are installing from github version consider checking [releases](https://github.com/sideffect0/django-fileprovider/releases)\n\n* add `fileprovider` to django `INSTALLED_APPS` section.  \n* add `fileprovider.middleware.FileProviderMiddleware` to `MIDDLEWARE_CLASSES` section\n* set django `settings` file with `FILEPROVIDER_NAME` any of  available providers `python`, `nginx`, `apache`, `lighthttpd`, \n`caddy`, `hiawatha`, `xsendfile`, `xaccel`.  \n\n ```python  \n    \n    # or you can put FILEPROVIDER_NAME as python in your local settings file  \n    if settings.DEBUG:\n        FILEPROVIDER_NAME = \"python\"\n    else:\n        # or apache, lighthttpd, caddy\n        FILEPROVIDER_NAME = \"nginx\"\n\n ```\n\n# USAGE  \n\n on django views where file response is required, fill response header `X-File` with absolute file path or use `sendfile` wrapper    \n for example,  \n\n ```python  \n\n    from fileprovider.utils import sendfile  \n    def hello(request):\n        return sendfile('/absolute/path/to/file')\n\n    # can be used protecting file access from unauthorized users\n    @login_required\n    def hello(request, file_id):\n        file = get_object_or_404(FileModel, pk=file_id)\n        return sendfile(file.path)\n\n ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsideffect0%2Fdjango-fileprovider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsideffect0%2Fdjango-fileprovider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsideffect0%2Fdjango-fileprovider/lists"}