Project create/list API, clip uploads, CORS, public read

- Project gains a clip FileField; POST /api/projects/ creates one from an
  uploaded otio + clip (<=100 MB), owned by the requester
- add /api/me/ and project-detail; scene GET is public (view without login),
  PUT stays owner/collaborator-only
- serve media in DEBUG (range requests for video seek); CORS for the cljs dev
  origin with credentials
- seed_demo now builds the Challengers project from the bundled otio + 480p clip

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-06-29 01:39:54 -04:00
parent 60fb4df795
commit 94475da936
9 changed files with 114 additions and 41 deletions

View file

@ -8,11 +8,13 @@ from django.core.management.base import BaseCommand
from scenes.models import Project
OTIO = settings.BASE_DIR / "tl" / "resources" / "public" / "one_two_three.otio"
PUBLIC = settings.BASE_DIR / "tl" / "resources" / "public"
OTIO = PUBLIC / "one_two_three.otio"
CLIP = PUBLIC / "challengers_480p.mp4"
class Command(BaseCommand):
help = "Seed a demo project from the bundled OTIO file."
help = "Seed the demo Challengers project from the bundled OTIO + clip."
def handle(self, *args, **opts):
User = get_user_model()
@ -22,10 +24,14 @@ class Command(BaseCommand):
return
project, created = Project.objects.get_or_create(
owner=owner, name="one two three", defaults={"scene": {}})
owner=owner, name="Challengers", defaults={"scene": {}})
if OTIO.exists() and not project.otio:
with OTIO.open("rb") as fh:
project.otio.save(Path(OTIO).name, File(fh), save=True)
project.otio.save(OTIO.name, File(fh), save=True)
if CLIP.exists() and not project.clip:
with CLIP.open("rb") as fh:
project.clip.save(CLIP.name, File(fh), save=True)
verb = "created" if created else "exists"
self.stdout.write(f"project #{project.pk} {verb}: {project.name} (otio={bool(project.otio)})")
self.stdout.write(f"project #{project.pk} {verb}: {project.name} "
f"(otio={bool(project.otio)} clip={bool(project.clip)})")