From 18e7c671597f4e888ace30ac89bed84cde29a384 Mon Sep 17 00:00:00 2001 From: Iamjava Date: Sat, 19 Oct 2024 17:17:11 +0200 Subject: [PATCH] better build --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index df6784a..e68d2be 100644 --- a/app.py +++ b/app.py @@ -225,7 +225,8 @@ def main(): if not os.path.exists('static'): os.makedirs('static') request.files['image'].save(os.path.join('static', id)) if DB_DRIVER == "JSON": - with open(DATAFILE, 'x') as db_file: + mode = 'a' if os.path.exists(DATAFILE) else 'w' + with open(DATAFILE, mode) as db_file: try: recipes = json.load(db_file) except Exception: