From 9cde15c3cec3754e518572f4ad9ffc6a7a99978a Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 5 Mar 2026 16:53:05 +0000 Subject: [PATCH] Skip DB registration in standalone mode (fixes sx-web.org startup) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sx app is stateless — no database needed. In standalone mode (SX_STANDALONE=true), the factory now skips register_db() so the app doesn't crash trying to connect to a non-existent PostgreSQL. Co-Authored-By: Claude Opus 4.6 --- shared/infrastructure/factory.py | 4 +++- sx/app.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/infrastructure/factory.py b/shared/infrastructure/factory.py index ce99672..c1c9298 100644 --- a/shared/infrastructure/factory.py +++ b/shared/infrastructure/factory.py @@ -48,6 +48,7 @@ def create_base_app( before_request_fns: Sequence[Callable[[], Awaitable[None]]] | None = None, domain_services_fn: Callable[[], None] | None = None, no_oauth: bool = False, + no_db: bool = False, ) -> Quart: """ Create a Quart app with shared infrastructure. @@ -111,7 +112,8 @@ def create_base_app( # --- infrastructure --- register_middleware(app) - register_db(app) + if not no_db: + register_db(app) register_redis(app) setup_jinja(app) setup_sx_bridge(app) diff --git a/sx/app.py b/sx/app.py index 5d19739..dca9ab2 100644 --- a/sx/app.py +++ b/sx/app.py @@ -58,6 +58,7 @@ def create_app() -> "Quart": extra_kw = {} if SX_STANDALONE: extra_kw["no_oauth"] = True + extra_kw["no_db"] = True app = create_base_app( "sx",