diff options
| -rw-r--r-- | app/__init__.py | 10 | ||||
| -rw-r--r-- | config.py | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/__init__.py b/app/__init__.py index 7bad100..ec675e5 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -35,6 +35,16 @@ def create_app(config_class=Config): mail.init_app(app) bootstrap.init_app(app) + # Initialize the instance directory and necessary subdirectories + os.makedirs(app.instance_path, exist_ok=True) + os.makedirs( + os.path.join(app.instance_path, app.config["TEMP_DIR"]), exist_ok=True + ) + os.makedirs( + os.path.join(app.instance_path, app.config["DATASET_DIR"]), + exist_ok=True, + ) + # Register all the blueprints from app.errors import bp as errors_bp @@ -22,3 +22,7 @@ class Config(object): MAIL_USERNAME = os.environ.get('MAIL_USERNAME') MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') ADMINS = ['gvandenburg@turing.ac.uk'] + + # these should be used relative to the instance path + DATASET_DIR = "datasets" + TEMP_DIR = "tmp" |
