skillfed

django-private-storage

Private media file storage for Django projects

django-private-storage v3.1.3 74.2K downloads/30d#14,861 on PyPI351
Permissive license License-Expression :: OSI Approved :: Apache-2.0 AGING released

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-storage

uv

uv add django-private-storage

poetry

poetry add django-private-storage

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.0Framework :: Django :: 3.1Framework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.12Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules

Tags

django private file storageprotected user uploads djangologin-required file downloadsdjango private media filesauthenticated file access djangodjango file permissions storagesecure user uploads django
django-storagefile-permissionss3-minio-support

More Python Modules packages

idna

Converts domain names between Unicode and…

permissive · top 100 on PyPI

setuptools

Setuptools is a Python build backend and…

permissive · top 100 on PyPI

PyYAML

PyYAML parses and emits YAML 1.1 data format,…

permissive · top 100 on PyPI

pydantic

Pydantic validates Python data structures…

permissive · top 100 on PyPI

annotated-types

Provides reusable metadata objects for use with…

permissive · top 100 on PyPI

typing-inspection

Provides runtime tools to inspect and…

permissive · top 100 on PyPI

django-s3-storage

Provides Django file storage backends that read…

permissive · top 15,000 on PyPI

django-dbbackup

Provides Django management commands to backup…

permissive · top 15,000 on PyPI

django-cryptography

Wraps Python's cryptography library to add…

permissive · top 15,000 on PyPI

synapse-s3-storage-provider

A Synapse media storage provider that…

permissive · top 15,000 on PyPI

django-enumfields

Provides Django model fields that store Python…

permissive · top 15,000 on PyPI

django-cryptography-5

Provides encrypted model fields and…

permissive · top 15,000 on PyPI

django-constance

Django-constance lets you store and manage…

permissive · top 5,000 on PyPI

django-cloudinary-storage

Integrates Django with Cloudinary to serve…

permissive · top 15,000 on PyPI

django-reverse-admin

Adds reverse inline support to Django admin for…

permissive · top 15,000 on PyPI

django-nested-inline

Enables nested inline editing in Django admin,…

permissive · top 15,000 on PyPI