create folders from config if they dont exist so user doesnt have to

This commit is contained in:
cube
2026-05-09 14:33:38 +01:00
parent 8520ad6777
commit bd7cc5a710

View File

@@ -11,8 +11,13 @@ def create_app():
app.config.from_pyfile('config.py') app.config.from_pyfile('config.py')
app.config.from_mapping(DATABASE=os.path.join(app.instance_path, 'database.sqlite'),) app.config.from_mapping(DATABASE=os.path.join(app.instance_path, 'database.sqlite'),)
# ensure the instance folder exists # ensure the necessary directories exist
os.makedirs(app.instance_path, exist_ok=True) os.makedirs(app.instance_path, exist_ok=True)
os.makedirs(app.config["ICON_UPLOAD_FOLDER"], exist_ok=True)
os.makedirs(app.config["BLINKIES_UPLOAD_FOLDER"], exist_ok=True)
os.makedirs(app.config["STAMPS_UPLOAD_FOLDER"], exist_ok=True)
os.makedirs(app.config["MISC_UPLOAD_FOLDER"], exist_ok=True)
os.makedirs(app.config["TMP_FOLDER"], exist_ok=True)
from . import db from . import db
db.init_app(app) db.init_app(app)