From 084a161e800caa9dde3b2cf88d238869a038f448 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 23 Feb 2024 15:00:41 +1100 Subject: [PATCH] fix: Create dir on upload --- main.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 7cef77c..8b19334 100644 --- a/main.py +++ b/main.py @@ -120,10 +120,8 @@ def upload_site(name): return "Error: No file provided." if file: - if not os.path.exists('uploads'): - os.makedirs('uploads') - if not os.path.exists('uploads/' + name): - os.makedirs('uploads/' + name) + if not os.path.isdir('/var/www/{id}'.format(id=site['id'])): + os.mkdir('/var/www/{id}'.format(id=site['id'])) filename = file.filename