Skip to main content
Premium

Provider Selection

Provider selection is resolved per field from HABARICO_UPLOADS["ENABLED_PROVIDERS"], an ordered list of provider names. For each field, Habarico walks the list in order and picks the first provider that supports that field's storage:

  • "s3" supports a field only when its storage is an S3-compatible django-storages backend.
  • "tus" is storage-agnostic but is only available when TUS["ENDPOINT"] is configured.

Because the list is ordered, earlier entries win. For example ["s3", "tus"] uses S3 for fields on an S3 backend and falls back to tus for the rest, while ["tus", "s3"] prefers tus everywhere it is available. A model with file fields on different storages gets the appropriate provider for each field independently.

ENABLED_PROVIDERS defaults to [], which disables chunked uploads entirely (file fields fall back to base64 encoding, fully backward compatible). An unknown provider name raises ImproperlyConfigured at startup (from UploadsConfig.ready()), so a configuration typo stops the server instead of silently disabling chunked upload.

When no enabled provider supports a field (e.g. only "s3" is enabled but the field is on the local filesystem, or "tus" is enabled without an endpoint), the field falls back to base64 and no upload block is emitted in its schema. Likewise, if the S3 provider cannot derive a client from the field's storage (e.g. the uploads-s3 dependency isn't installed), Habarico logs a warning and falls back to base64 (no upload block, endpoints return 404) - the same graceful degradation.