diff options
| author | Mitsuo Tokumori <rtokumori@pucp.edu.pe> | 2023-11-13 10:55:39 -0500 |
|---|---|---|
| committer | Mitsuo Tokumori <rtokumori@pucp.edu.pe> | 2023-11-13 10:55:39 -0500 |
| commit | 5a16046eddc753b752c5ab1fdb91595adf588a6b (patch) | |
| tree | 870192e1f576754c6fd669cd4e3dad6f70a7caf7 /ustayml/db.py | |
| parent | f6fcf9cc3ae3d93d59391b3f12843fba3297f0b2 (diff) | |
Add sample file upload for "load_data" blueprint
Also add a success page that redirects to the Dashboard
Diffstat (limited to 'ustayml/db.py')
| -rw-r--r-- | ustayml/db.py | 15 |
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 |
