2022-06-08 16:14:39 +00:00
|
|
|
"""This is my docstring."""
|
2022-06-01 18:50:44 +00:00
|
|
|
from werkzeug.exceptions import NotFound
|
|
|
|
from werkzeug.middleware.dispatcher import DispatcherMiddleware
|
|
|
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
|
|
|
|
|
|
from spiffworkflow_backend import create_app
|
|
|
|
|
|
|
|
app = create_app()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-06-02 14:17:53 +00:00
|
|
|
|
2022-06-01 18:50:44 +00:00
|
|
|
def no_app(environ, start_response):
|
2022-06-08 16:14:39 +00:00
|
|
|
"""This is."""
|
2022-06-01 18:50:44 +00:00
|
|
|
return NotFound()(environ, start_response)
|
|
|
|
|
|
|
|
# Remove trailing slash, but add leading slash
|
2022-06-02 14:17:53 +00:00
|
|
|
base_url = "/" + app.config["APPLICATION_ROOT"].strip("/")
|
|
|
|
routes = {"/": app.wsgi_app}
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2022-06-02 14:17:53 +00:00
|
|
|
if base_url != "/":
|
2022-06-01 18:50:44 +00:00
|
|
|
routes[base_url] = app.wsgi_app
|
|
|
|
|
|
|
|
app.wsgi_app = DispatcherMiddleware(no_app, routes)
|
|
|
|
app.wsgi_app = ProxyFix(app.wsgi_app)
|
|
|
|
|
2022-06-02 14:17:53 +00:00
|
|
|
flask_port = app.config["FLASK_PORT"]
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2022-06-02 14:17:53 +00:00
|
|
|
app.run(host="0.0.0.0", port=flask_port)
|