Skip to content

Commit

Permalink
better build
Browse files Browse the repository at this point in the history
  • Loading branch information
corgijan committed Oct 19, 2024
1 parent 57a5eef commit 18e7c67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 18e7c67

Please sign in to comment.