aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-08-31 08:32:18 -0400
committerB. Stack <bgstack15@gmail.com>2023-08-31 08:32:18 -0400
commit4b0f1316fcdd74580d7fcd6893c6657f4c5dd1a2 (patch)
treeaf64879b6ac3ca517fc93c4d1e23ee0cbdb1aac8
parentleave PREFIX disabled by default in config (diff)
downloadnewspipe-4b0f1316fcdd74580d7fcd6893c6657f4c5dd1a2.tar.gz
newspipe-4b0f1316fcdd74580d7fcd6893c6657f4c5dd1a2.tar.bz2
newspipe-4b0f1316fcdd74580d7fcd6893c6657f4c5dd1a2.zip
try DispatcherMiddleware
-rw-r--r--newspipe/bootstrap.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py
index 9160c857..a5ebc862 100644
--- a/newspipe/bootstrap.py
+++ b/newspipe/bootstrap.py
@@ -3,6 +3,7 @@ import calendar
import logging
import os
+from werkzeug.middleware.dispatcher import DispatcherMiddleware
from flask import Flask
from flask import request
from flask_babel import Babel
@@ -44,14 +45,14 @@ def set_logging(
handler.setLevel(log_level)
logger.setLevel(log_level)
-class ReverseProxied(object):
- def __init__(self, app, script_name):
- self.app = app
- self.script_name = script_name
-
- def __call__(self, environ, start_response):
- environ['SCRIPT_NAME'] = self.script_name
- return self.app(environ, start_response)
+#class ReverseProxied(object):
+# def __init__(self, app, script_name):
+# self.app = app
+# self.script_name = script_name
+#
+# def __call__(self, environ, start_response):
+# environ['SCRIPT_NAME'] = self.script_name
+# return self.app(environ, start_response)
# Create Flask application
application = Flask(__name__, instance_relative_config=True)
@@ -72,7 +73,9 @@ else:
set_logging(application.config["LOG_PATH"])
if "PREFIX" in application.config:
- application.wsgi_app = ReverseProxied(application.wsgi_app, script_name=application.config["PREFIX"])
+ #application.wsgi_app = ReverseProxied(application.wsgi_app, script_name=application.config["PREFIX"])
+ _app = application
+ application = DispatcherMiddleware(None,str({application.config["PREFIX"]}):_app})
db = SQLAlchemy(application)
bgstack15