From e1d0d235e9ff3df723cce67dc1e607a768be7b94 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Sat, 4 May 2024 17:50:33 +0200 Subject: [PATCH] =?UTF-8?q?klara=20arbitr=C3=A4ra=20upload=20dirs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tv.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tv.py b/src/tv.py index fdac162..251b4d1 100644 --- a/src/tv.py +++ b/src/tv.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, flash, redirect, request, json +from flask import Flask, render_template, flash, redirect, request, json, send_from_directory from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager @@ -7,7 +7,7 @@ from config import Config as config -app = Flask(__name__) +app = Flask(__name__, static_folder=None) app.config.from_object(config) app.app_context().push() @@ -63,3 +63,7 @@ def pr(): [("/static/pr/" + user.file_name) for user in PR.query.filter(PR.start_date < datetime.now()).all()] ) + +@app.route('/static/pr/') +def static(path): + return send_from_directory(config.UPLOAD_FOLDER, path)