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>
26 lines
808 B
Python
26 lines
808 B
Python
"""Django Ninja API wiring."""
|
|
from ninja import NinjaAPI
|
|
|
|
from privatestudio.studio.auth import ApiKeyAuth
|
|
from privatestudio.studio.routers import keys, profiles, s3_keys, transcode, userinfo
|
|
|
|
api = NinjaAPI(
|
|
title="Private Studio",
|
|
description="Video transcoding web service with S3-compatible interface",
|
|
version="0.1.0",
|
|
auth=ApiKeyAuth(),
|
|
urls_namespace="api",
|
|
)
|
|
|
|
|
|
@api.exception_handler(ValueError)
|
|
def value_error_handler(request, exc):
|
|
return api.create_response(request, {"detail": str(exc)}, status=400)
|
|
|
|
|
|
api.add_router("", keys.router, tags=["Keys"])
|
|
api.add_router("", s3_keys.router, tags=["S3 Keys"])
|
|
api.add_router("", userinfo.router, tags=["UserInfo"])
|
|
api.add_router("", profiles.router, tags=["Profiles"])
|
|
api.add_router("", transcode.router, tags=["Transcode"])
|