{"id":23591,"library":"django-private-storage","title":"django-private-storage","description":"Provides private media file storage for Django projects, allowing files to be served only to authenticated users with permission checks. Version 3.1.3 is current. Release cadence is irregular.","status":"active","version":"3.1.3","language":"python","source_language":"en","source_url":"https://github.com/edoburu/django-private-storage","tags":["django","storage","private-files","media"],"install":[{"cmd":"pip install django-private-storage","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core framework","package":"Django","optional":false}],"imports":[{"note":"Wrong: PrivateStorage is not defined at the package level; must import from the specific submodule.","wrong":"from private_storage import PrivateStorage","symbol":"PrivateStorage","correct":"from private_storage.storage.filesystem import PrivateStorage"},{"note":"Wrong: PrivateMediaView is a class-based view in private_storage.views.","wrong":"from private_storage.views.PrivateStorage import ...","symbol":"PrivateMediaView","correct":"from private_storage.views import PrivateMediaView"}],"quickstart":{"code":"INSTALLED_APPS = [\n    'private_storage',\n    ...\n]\n\nPRIVATE_STORAGE_ROOT = '/path/to/private/media/'\nPRIVATE_STORAGE_AUTH_FUNCTION = 'private_storage.permissions.allow_authenticated'\n\nfrom private_storage.storage.filesystem import PrivateStorage\nprivate_storage = PrivateStorage()","lang":"python","description":"Add to INSTALLED_APPS, configure root and auth function, then use PrivateStorage as the storage backend."},"warnings":[{"fix":"Set the auth function explicitly in Django settings.","message":"The default auth function is `allow_staff` (only staff users). If you want all authenticated users, set `PRIVATE_STORAGE_AUTH_FUNCTION = 'private_storage.permissions.allow_authenticated'`.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from private_storage.storage.filesystem import PrivateStorage` as the storage class.","message":"PrivateStorage does not work with the default Django file storage; it requires a custom storage backend. Do not use `DefaultStorage` or `FileSystemStorage` for private files.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from private_storage.storage.filesystem import PrivateStorage`.","message":"Before version 3, the import path was `from private_storage.storage import PrivateStorage`. In v3, the storage classes moved to submodules.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add PRIVATE_STORAGE_ROOT = '/path/to/storage/' to your Django settings.","cause":"Missing PRIVATE_STORAGE_ROOT setting.","error":"django.core.exceptions.ImproperlyConfigured: PRIVATE_STORAGE_ROOT is not set."},{"fix":"Use `from private_storage.storage.filesystem import PrivateStorage`.","cause":"Wrong import path in version 3.","error":"AttributeError: module 'private_storage.storage' has no attribute 'PrivateStorage'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}