removing the workaround, causes error on octomode that is installed at the varia server
This commit is contained in:
parent
58f4cda11a
commit
a30972e87d
1 changed files with 0 additions and 22 deletions
22
octomode.py
22
octomode.py
|
|
@ -17,28 +17,6 @@ import markdown
|
||||||
APP = Flask(__name__)
|
APP = Flask(__name__)
|
||||||
APP.config.from_object("config.Config")
|
APP.config.from_object("config.Config")
|
||||||
|
|
||||||
# ---
|
|
||||||
# Workaround to map urls if the application runs from a non-root URL
|
|
||||||
# From: https://stackoverflow.com/questions/18967441/add-a-prefix-to-all-flask-routes
|
|
||||||
|
|
||||||
class PrefixMiddleware(object):
|
|
||||||
|
|
||||||
def __init__(self, app, prefix=''):
|
|
||||||
self.app = app
|
|
||||||
self.prefix = prefix
|
|
||||||
|
|
||||||
def __call__(self, environ, start_response):
|
|
||||||
|
|
||||||
if environ['PATH_INFO'].startswith(self.prefix):
|
|
||||||
environ['PATH_INFO'] = environ['PATH_INFO'][len(self.prefix):]
|
|
||||||
environ['SCRIPT_NAME'] = self.prefix
|
|
||||||
return self.app(environ, start_response)
|
|
||||||
else:
|
|
||||||
start_response('404', [('Content-Type', 'text/plain')])
|
|
||||||
return ["This url does not belong to the app.".encode()]
|
|
||||||
|
|
||||||
APP.wsgi_app = PrefixMiddleware(APP.wsgi_app, prefix=APP.config['APPLICATION_ROOT'])
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
def get_pad_content(pad_name, ext=""):
|
def get_pad_content(pad_name, ext=""):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue