From 5a16046eddc753b752c5ab1fdb91595adf588a6b Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Mon, 13 Nov 2023 10:55:39 -0500 Subject: Add sample file upload for "load_data" blueprint Also add a success page that redirects to the Dashboard --- ustayml/db.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ustayml/db.py') 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 -- cgit v1.2.3