Convert web service from FastAPI to Django 6.1 #2

Merged
skruger merged 3 commits from django into main 2026-12-01 17:30:33 -07:00
Owner

Replace the FastAPI/SQLAlchemy/Alembic web service with a Django project
laid out like cumorah-build: manage.py at the root, settings in the
privatestudio.settings package (base/dev/production), and a
privatestudio.studio app.

  • Studio model owns a unique bucket_name; access is granted through
    membership in the studio's auth Group. Assets, profiles and jobs are
    scoped to a studio; API keys and S3 credentials stay per user.
  • JSON API via Django Ninja under /api/ (profiles and transcode jobs now
    live under /api/studios/{bucket}/).
  • S3-compatible interface as plain class-based views under /s3/,
    supporting bearer tokens and AWS v4 signatures.
  • create_studio and create_key management commands replace ps-serve.
  • Fresh Django initial migration; tests ported to Django TestCase.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Replace the FastAPI/SQLAlchemy/Alembic web service with a Django project laid out like cumorah-build: manage.py at the root, settings in the privatestudio.settings package (base/dev/production), and a privatestudio.studio app. - Studio model owns a unique bucket_name; access is granted through membership in the studio's auth Group. Assets, profiles and jobs are scoped to a studio; API keys and S3 credentials stay per user. - JSON API via Django Ninja under /api/ (profiles and transcode jobs now live under /api/studios/{bucket}/). - S3-compatible interface as plain class-based views under /s3/, supporting bearer tokens and AWS v4 signatures. - create_studio and create_key management commands replace ps-serve. - Fresh Django initial migration; tests ported to Django TestCase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
skruger added 1 commit 2026-11-29 22:28:19 -07:00
Replace the FastAPI/SQLAlchemy/Alembic web service with a Django project
laid out like cumorah-build: manage.py at the root, settings in the
privatestudio.settings package (base/dev/production), and a
privatestudio.studio app.

- Studio model owns a unique bucket_name; access is granted through
  membership in the studio's auth Group. Assets, profiles and jobs are
  scoped to a studio; API keys and S3 credentials stay per user.
- JSON API via Django Ninja under /api/ (profiles and transcode jobs now
  live under /api/studios/{bucket}/).
- S3-compatible interface as plain class-based views under /s3/,
  supporting bearer tokens and AWS v4 signatures.
- create_studio and create_key management commands replace ps-serve.
- Fresh Django initial migration; tests ported to Django TestCase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
skruger added 1 commit 2026-12-01 16:47:29 -07:00
skruger added 1 commit 2026-12-01 17:29:52 -07:00
Stream uploads and downloads in 1 MB blocks so memory use does not grow
with file size, under both WSGI and ASGI.

- S3 multipart upload API (create, upload part, list parts, complete,
  abort), so boto3 upload_file works for files over 8 MB.
- Browser uploader on the studio page: sends 16 MB parts three at a
  time with retries, and resumes when the same file is picked again.
  Uses session-authenticated, CSRF-protected JSON endpoints under
  /studio/<bucket>/uploads/.
- Request bodies are checked against the signed X-Amz-Content-Sha256
  instead of being read into memory; signed requests must include it.
  boto3's aws-chunked bodies with CRC32 trailers are decoded.
- Objects are written to a temporary file and renamed into place, so a
  failed upload leaves the existing file intact.
- Downloads stream with FileResponse, or an async iterator under ASGI.
- SigV4 verification uses the encoded path, fixing keys with spaces.
- cleanup_uploads command removes abandoned uploads and temp files.
- DATA_UPLOAD_MAX_MEMORY_SIZE is capped at 10 MB again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
skruger force-pushed django from 1327f929e1 to 3bbb57760e 2026-12-01 17:29:52 -07:00 Compare
skruger merged commit d73dddc3d9 into main 2026-12-01 17:30:33 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: skruger/privatestudio#2