From 451c30d2d30e45a91d92fbb1b06a1d28a151e773 Mon Sep 17 00:00:00 2001 From: Sam Johnston Date: Tue, 13 Aug 2024 15:21:13 +0200 Subject: [PATCH] move init_db() from __init__.py to app.py --- backend/__init__.py | 3 --- backend/app.py | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index 0a8d08e6..c914b9f3 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -1,7 +1,6 @@ # backend package import os from common import paths -from backend.db import init_db # List of directories to ensure exist required_directories = [ @@ -13,5 +12,3 @@ if not os.path.exists(directory): os.makedirs(directory) -# Initialize the database -init_db() diff --git a/backend/app.py b/backend/app.py index dff36c4f..84e3734e 100644 --- a/backend/app.py +++ b/backend/app.py @@ -3,8 +3,12 @@ from connexion.resolver import MethodResolver from connexion.middleware import MiddlewarePosition from starlette.middleware.cors import CORSMiddleware +from backend.db import init_db def create_backend_app(): + # Initialize the database + init_db() + apis_dir = Path(__file__).parent.parent / 'apis' / 'paios' connexion_app = AsyncApp(__name__, specification_dir=apis_dir)