Add Fly release image and local start command

This commit is contained in:
Olive Vaughn 2026-09-28 10:45:07 -04:00
parent 7249e73e7c
commit 690de21fa4
7 changed files with 176 additions and 7 deletions

View file

@ -14,15 +14,22 @@ of what there is to know about this file:
`var/blobs`. Never in the database, and never in a migration.
"""
from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent.parent
# Dev default. The deployment that needs a real one will set it, and until there
# is a deployment, a checked-in placeholder that says so beats a checked-in secret
# that does not.
SECRET_KEY = "dev-only-not-a-secret-arthur"
DEBUG = True
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "[::1]"]
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", "dev-only-not-a-secret-arthur")
DEBUG = os.environ.get("DJANGO_DEBUG", "1").lower() in {"1", "true", "yes"}
ALLOWED_HOSTS = os.environ.get(
"DJANGO_ALLOWED_HOSTS", "localhost,127.0.0.1,[::1]"
).split(",")
CSRF_TRUSTED_ORIGINS = [
origin for origin in os.environ.get("DJANGO_CSRF_TRUSTED", "").split(",")
if origin
]
INSTALLED_APPS = [
"django.contrib.admin",
@ -36,6 +43,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
@ -77,7 +85,7 @@ TEMPLATES = [
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
"NAME": os.environ.get("DJANGO_DB_PATH", str(BASE_DIR / "db.sqlite3")),
"OPTIONS": {
"timeout": 20,
"init_command": "PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;",
@ -107,6 +115,10 @@ STATICFILES_DIRS = [
("mediapipe", BASE_DIR / "frontend" / "public" / "mediapipe"),
]
STATIC_ROOT = BASE_DIR / "var" / "static"
STORAGES = {
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedStaticFilesStorage"},
}
# --- blobs ------------------------------------------------------------------
#
@ -115,7 +127,7 @@ STATIC_ROOT = BASE_DIR / "var" / "static"
# `static/`: a blob is served by a view that can set immutable cache headers and
# refuse a path that is not a hash, and `collectstatic` has no business walking
# gigabytes of frames.
BLOB_ROOT = BASE_DIR / "var" / "blobs"
BLOB_ROOT = Path(os.environ.get("DJANGO_BLOB_ROOT", str(BASE_DIR / "var" / "blobs")))
# The port the browser suite expects by default, and not 8777, which is still the
# old JS tool's under `serve.py`. Both are meant to run side by side.