Skip to content

Configure S3/R2 file storage for photo uploads #9

Description

@robert197

Description

Set up cloud file storage for inspection photos using django-storages.

Requirements

  • django-storages with S3-compatible backend (works with AWS S3 and Cloudflare R2)
  • Separate storage backends:
    • MediaStorage for user uploads (photos)
    • StaticStorage for static files (optional, can use default)
  • Automatic thumbnail generation on upload (Pillow)
    • Thumbnail size: 300x300 max, maintaining aspect ratio
  • Signed URLs for private photo access (24h expiry)
  • Local file storage fallback for development (MEDIA_ROOT)
  • Upload size limit: 10MB per photo
  • Accepted formats: JPEG, PNG, HEIC (convert HEIC to JPEG on upload)

Configuration

# settings/base.py
STORAGES = {
    "default": {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"},
    "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
}

Acceptance Criteria

  • Photos upload to S3/R2 in production
  • Local dev uses filesystem storage
  • Thumbnails auto-generated on upload
  • Signed URLs work with configurable expiry
  • HEIC to JPEG conversion works

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions