From 095494f96f00b33dc9e956b094105c49b5bc558b Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 18 Jan 2020 01:20:32 +0000 Subject: Improve Docker configurations --- app/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/utils.py') diff --git a/app/utils.py b/app/utils.py index 102219d..5d1c8da 100644 --- a/app/utils.py +++ b/app/utils.py @@ -46,6 +46,8 @@ def randomString(n): return ''.join(random.choice(string.ascii_lowercase + \ string.ascii_uppercase + string.digits) for _ in range(n)) +assert(os.path.isdir(app.config["UPLOAD_DIR"]), "UPLOAD_DIR must exist") + def doFileUpload(file, fileType, fileTypeDesc): if not file or file is None or file.filename == "": flash("No selected file", "error") @@ -73,7 +75,7 @@ def doFileUpload(file, fileType, fileTypeDesc): file.stream.seek(0) filename = randomString(10) + "." + ext - file.save(os.path.join("app/public/uploads", filename)) + file.save(os.path.join(app.config["UPLOAD_DIR"], filename)) return "/uploads/" + filename def make_flask_user_password(plaintext_str): -- cgit v1.2.3