safety check so db folder exists
This commit is contained in:
parent
58c843800c
commit
da222b5d11
1 changed files with 3 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
|
import os
|
||||||
import dictdatabase as DDB
|
import dictdatabase as DDB
|
||||||
from config.db_settings import DatabaseSettings
|
from config.db_settings import DatabaseSettings
|
||||||
|
|
||||||
|
@ -12,6 +13,8 @@ class Database:
|
||||||
"""
|
"""
|
||||||
__instance = None
|
__instance = None
|
||||||
db = DDB
|
db = DDB
|
||||||
|
if not os.path.isdir(DatabaseSettings.DATABASE_DIRECTORY):
|
||||||
|
os.mkdir(DatabaseSettings.DATABASE_DIRECTORY)
|
||||||
db.config.storage_directory = DatabaseSettings.DATABASE_DIRECTORY
|
db.config.storage_directory = DatabaseSettings.DATABASE_DIRECTORY
|
||||||
if not db.at("requests").exists():
|
if not db.at("requests").exists():
|
||||||
db.at("requests").create({})
|
db.at("requests").create({})
|
||||||
|
|
Loading…
Reference in a new issue