From 2a346b6dc0afcd6067d35b633fe39d84ed643ba0 Mon Sep 17 00:00:00 2001 From: Jekannadar Date: Mon, 9 Sep 2024 13:15:18 +0200 Subject: [PATCH] Add minor fix for locally run instances where the database was not getting initialized in some cases --- applications/cls-cad-backend/cls_cad_backend/server.py | 4 +++- applications/cls-cad-backend/main.py | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/cls-cad-backend/cls_cad_backend/server.py b/applications/cls-cad-backend/cls_cad_backend/server.py index 47b5628..b8736eb 100644 --- a/applications/cls-cad-backend/cls_cad_backend/server.py +++ b/applications/cls-cad-backend/cls_cad_backend/server.py @@ -12,7 +12,7 @@ get_taxonomy_for_project, upsert_part, upsert_result, - upsert_taxonomy, + upsert_taxonomy, init_database, ) from cls_cad_backend.repository_builder import RepositoryBuilder, wrapped_counted_types from cls_cad_backend.responses import FastResponse @@ -37,6 +37,8 @@ from starlette.background import BackgroundTasks from starlette.staticfiles import StaticFiles +init_database() + origins = [ "http://localhost:3000", "http://localhost:8000", diff --git a/applications/cls-cad-backend/main.py b/applications/cls-cad-backend/main.py index b30233e..f520df5 100644 --- a/applications/cls-cad-backend/main.py +++ b/applications/cls-cad-backend/main.py @@ -4,13 +4,11 @@ def start(): """Launched with `poetry run start` at root level.""" - init_database() uvicorn.run("cls_cad_backend.server:app", reload=True) def start_docker(): """Launched with `poetry run start` at root level.""" - init_database() uvicorn.run("cls_cad_backend.server:app", reload=False, host="0.0.0.0", port=80)