From da222b5d11e13ba81a8683bfe95c1328a83d0478 Mon Sep 17 00:00:00 2001 From: Firq Date: Sun, 1 Oct 2023 21:47:33 +0200 Subject: [PATCH] safety check so db folder exists --- backend/src/database/database.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/database/database.py b/backend/src/database/database.py index b482470..6c58890 100644 --- a/backend/src/database/database.py +++ b/backend/src/database/database.py @@ -1,5 +1,6 @@ # pylint: disable=too-few-public-methods +import os import dictdatabase as DDB from config.db_settings import DatabaseSettings @@ -12,6 +13,8 @@ class Database: """ __instance = None db = DDB + if not os.path.isdir(DatabaseSettings.DATABASE_DIRECTORY): + os.mkdir(DatabaseSettings.DATABASE_DIRECTORY) db.config.storage_directory = DatabaseSettings.DATABASE_DIRECTORY if not db.at("requests").exists(): db.at("requests").create({})