Convert web service from FastAPI to Django 6.1
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
46adddd50a
commit
b3b51f6cc5
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
|
||||
import dj_database_url
|
||||
|
||||
from .base import * # noqa: F401,F403
|
||||
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "*").split(",")
|
||||
|
||||
SECRET_KEY = os.environ.get("SECRET_KEY", "This isn't a good secret key default value, you should set one in the environment")
|
||||
|
||||
if os.environ.get("DATABASE_URL"):
|
||||
DATABASES = {
|
||||
"default": dj_database_url.config(),
|
||||
}
|
||||
|
||||
CORS_ALLOWED_ORIGINS = [o for o in os.environ.get("CORS_ALLOWED_ORIGINS", "").split(",") if o]
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = [f"https://{h}" for h in ALLOWED_HOSTS if h != "*"]
|
||||
|
||||
if os.environ.get("SECURE_PROXY_SSL_HEADER"):
|
||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"handlers": {
|
||||
"console": {
|
||||
"class": "logging.StreamHandler",
|
||||
"level": "INFO",
|
||||
},
|
||||
},
|
||||
"loggers": {
|
||||
"root": {
|
||||
"handlers": ["console"],
|
||||
"level": "WARNING",
|
||||
"propagate": True,
|
||||
},
|
||||
"privatestudio": {
|
||||
"handlers": ["console"],
|
||||
"level": "INFO",
|
||||
"propagate": False,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
try:
|
||||
from local_settings import * # noqa: F401,F403
|
||||
except ImportError:
|
||||
pass
|
||||
Reference in New Issue
Block a user