Files
shihaam c1f661cdb6
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5s
improve registration flows
2026-08-04 01:11:20 +05:00

27 lines
847 B
Python

"""Storage backends for the api app."""
from django.conf import settings
from django.core.files.storage import FileSystemStorage
class IdCardStorage(FileSystemStorage):
"""Filesystem storage for uploaded ID/passport photos.
Location/URL come from settings (IDCARD_STORAGE_ROOT / IDCARD_STORAGE_URL)
so the directory can be bind-mounted as a persistent volume in production.
"""
def __init__(self, **kwargs):
kwargs.setdefault("location", settings.IDCARD_STORAGE_ROOT)
kwargs.setdefault("base_url", settings.IDCARD_STORAGE_URL)
super().__init__(**kwargs)
def idcard_storage():
"""Callable referenced by the model field.
Using a named callable keeps the resolved location out of migrations, so
changing the mount path never requires a new migration.
"""
return IdCardStorage()