Skip to content

Commit

Permalink
add use_absolute_upload_path, and vidzy_absolute_path to vidzyconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramminCat committed Aug 20, 2024
1 parent 881e732 commit d93b002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 2 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
import nh3
import vidzyconfig

inproduction = False
productionpath = os.path.expanduser('~/mysite')


CLEANR = re.compile('<.*?>')
def cleanhtml(raw_html):
Expand Down Expand Up @@ -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))
Expand Down
6 changes: 5 additions & 1 deletion vidzyconfig.py
Original file line number Diff line number Diff line change
@@ -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')
}

0 comments on commit d93b002

Please sign in to comment.