django-private-storage
Private media file storage for Django projects
What it is and what it does
django-private-storage adds a custom file storage backend to Django that keeps uploaded files outside the web-accessible directory and gates access through authentication. It provides model fields that work seamlessly with Django's admin and form rendering, automatically enforcing access control based on configurable permission functions. The package supports local filesystem storage by default, with optional backends for Amazon S3 and MinIO object storage; you define which users can download files via a simple auth function, and the package handles serving files through a protected view.
The module integrates directly into Django's storage API, meaning existing form widgets and admin interfaces work without modification. You configure a root directory for private files, add the app to INSTALLED_APPS, include its URL patterns, and then use the provided field types in your models just like a regular FileField. Access control is pluggable—built-in options include allow_authenticated, allow_staff, and allow_superuser, or you can write a custom function that receives the request and file metadata.
Use it for:
- Restrict document downloads to logged-in users in a SaaS application
- Store confidential user uploads (contracts, invoices) behind authentication
- Serve images or media only to staff members via the admin interface
- Implement object-level access control by subclassing the provided detail view
- Offload private file storage to S3 or MinIO while maintaining Django model integration
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Django storage backend that restricts file uploads and downloads to authenticated users, integrating with Django's model fields and admin interface.
Yes. The package solves a common Django problem (protecting user uploads behind login) with minimal install friction, no runtime dependencies, and a stable API across modern Django versions. The aging maintenance status (313 days since last release) is acceptable for a mature, production-stable feature; no known vulnerabilities. Use it when you need to gate file access by user authentication without building custom storage logic.
Install
django-private-storage on PyPI
pip
pip install django-private-storageuv
uv add django-private-storagepoetry
poetry add django-private-storageInstalling django-private-storage
Before you install
Low friction install with no runtime dependencies. Last commit was 313 days ago; the project is in aging maintenance status but remains archived=false and carries a production/stable classifier across Django 2.2 through 5.2.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most production deployments.
Quickstart
pip install django-private-storage
# In settings.py
INSTALLED_APPS += ('private_storage',)
PRIVATE_STORAGE_ROOT = '/path/to/private-media/'
PRIVATE_STORAGE_AUTH_FUNCTION = 'private_storage.permissions.allow_staff'
# In urls.py
import private_storage.urls
urlpatterns += [path('private-media/', include(private_storage.urls))]
Requires Django to be installed and configured; no explicit Python version minimum stated in fact sheet.
Verify before relying
- Whether the package works with Django versions prior to 2.2 despite classifiers listing 2.2 as earliest
- Performance characteristics when serving large files through the private storage proxy
- Whether S3 and MinIO storage backends require additional package dependencies beyond what is listed
Package facts
| License | License-Expression :: OSI Approved :: Apache-2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 313 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,202/month — #14,861 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_private_storage-3.1.3-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-s3-storageProvides Django file storage backends that read…
permissive · top 15,000 on PyPI
django-dbbackupProvides Django management commands to backup…
permissive · top 15,000 on PyPI
django-cryptographyWraps Python's cryptography library to add…
permissive · top 15,000 on PyPI
synapse-s3-storage-providerA Synapse media storage provider that…
permissive · top 15,000 on PyPI
django-enumfieldsProvides Django model fields that store Python…
permissive · top 15,000 on PyPI
django-cryptography-5Provides encrypted model fields and…
permissive · top 15,000 on PyPI
django-constanceDjango-constance lets you store and manage…
permissive · top 5,000 on PyPI
django-cloudinary-storageIntegrates Django with Cloudinary to serve…
permissive · top 15,000 on PyPI
django-reverse-adminAdds reverse inline support to Django admin for…
permissive · top 15,000 on PyPI
django-nested-inlineEnables nested inline editing in Django admin,…
permissive · top 15,000 on PyPI