From 6e5b7b722e021f36abe309c1c2e8c416ccf217ae Mon Sep 17 00:00:00 2001 From: oqyude Date: Fri, 16 Oct 2026 14:08:54 +0300 Subject: [PATCH] fix(engipy-backend): uvicorn --factory app.main:create_app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В app/main.py нет module-level 'app' — только create_app() функция- фабрика (создаёт экземпляр FastAPI на каждый запуск). Без --factory uvicorn ждёт 'app.main:app' (атрибут 'app' в модуле), не находит его и завершается 'Attribute app not found in module app.main'. smoke_api.sh в проекте использует именно '--factory app.main:create_app', это рабочий паттерн для engipy — перенёс в systemd ExecStart. --- modules/server/engipy-backend.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/server/engipy-backend.nix b/modules/server/engipy-backend.nix index 5d6acc7..5792cf5 100644 --- a/modules/server/engipy-backend.nix +++ b/modules/server/engipy-backend.nix @@ -220,7 +220,7 @@ in User = cfg.user; Group = cfg.user; WorkingDirectory = cfg.dataDir; - ExecStart = "${cfg.dataDir}/venv/bin/uvicorn app.main:app" + ExecStart = "${cfg.dataDir}/venv/bin/uvicorn --factory app.main:create_app" + " --host ${cfg.bindAddress} --port ${toString cfg.port} --no-access-log"; Restart = "on-failure"; RestartSec = "5s";