aboutsummaryrefslogtreecommitdiff
path: root/ustayml/db.py
diff options
context:
space:
mode:
Diffstat (limited to 'ustayml/db.py')
-rw-r--r--ustayml/db.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/ustayml/db.py b/ustayml/db.py
index 04587cc..5fb5ea8 100644
--- a/ustayml/db.py
+++ b/ustayml/db.py
@@ -35,6 +35,16 @@ def close_db(e=None):
# CLI:
# https://flask.palletsprojects.com/en/3.0.x/cli/
+def init_fs():
+ """Init file system directories"""
+ import os
+ dirs = [
+ current_app.config['DATASET_PATH'],
+ current_app.config['STUDENT_DATA_PATH']
+ ]
+ for d in dirs:
+ os.makedirs(d, exist_ok=True)
+
def init_db():
db = get_db()
@@ -45,8 +55,9 @@ def init_db():
@click.command('init-db')
def init_db_command():
"""Clear the existing data and create new tables."""
- init_db()
- click.echo('Initialized the database.')
+ init_fs()
+ # init_db()
+ # click.echo('Initialized the database.')
# Register function with application