mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-08-11 09:13:48 -04:00
Redirect / when url-prefix is set
This commit is contained in:
parent
f0da36801f
commit
2020efa4e6
@ -257,9 +257,17 @@ def get_args():
|
||||
|
||||
def main():
|
||||
args = get_args()
|
||||
app = DispatcherMiddleware(None, {
|
||||
args.url_prefix: create_app(args)
|
||||
})
|
||||
|
||||
if args.url_prefix:
|
||||
def redirect(environ, start_response):
|
||||
start_response("301 REDIRECT", [("Content-Type", "text/plain"), ("Location", args.url_prefix)])
|
||||
yield b"Redirect..."
|
||||
|
||||
app = DispatcherMiddleware(redirect, {
|
||||
args.url_prefix: create_app(args)
|
||||
})
|
||||
else:
|
||||
app = DispatcherMiddleware(create_app(args))
|
||||
|
||||
if '--wsgi' in sys.argv:
|
||||
return app
|
||||
|
Loading…
x
Reference in New Issue
Block a user