From d93b0025339dce84f670289492a1d1e688ca8339 Mon Sep 17 00:00:00 2001 From: snowcatridge10 <72707293+ProgramminCat@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:04:29 -0400 Subject: [PATCH] add use_absolute_upload_path, and vidzy_absolute_path to vidzyconfig --- app.py | 7 ++----- vidzyconfig.py | 6 +++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index feb4c3b..328f02b 100644 --- a/app.py +++ b/app.py @@ -16,9 +16,6 @@ import nh3 import vidzyconfig -inproduction = False -productionpath = os.path.expanduser('~/mysite') - CLEANR = re.compile('<.*?>') def cleanhtml(raw_html): @@ -810,8 +807,8 @@ def upload_file(): return redirect(request.url) if file and allowed_file(file.filename): filename = datetime.today().strftime('%Y%m%d') + secure_filename(file.filename) - if inproduction: - project_folder = productionpath # adjust as appropriate + if vidzyconfig.config["use_absolute_upload_path"]: + project_folder = vidzyconfig.config["vidzy_absolute_path"] file.save(os.path.join(project_folder + '/' + app.config['UPLOAD_FOLDER'], filename)) else: file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) diff --git a/vidzyconfig.py b/vidzyconfig.py index 54609a9..44e9cb0 100644 --- a/vidzyconfig.py +++ b/vidzyconfig.py @@ -1,3 +1,7 @@ +import os + config = { - "ALLOW_UPLOADS": True + "ALLOW_UPLOADS": True, + "use_absolute_upload_path": False, + "vidzy_absolute_path": os.path.expanduser('~/mysite') } \ No newline at end of file