summaryrefslogtreecommitdiff
path: root/doc/invocations-http-server/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/invocations-http-server/server.py')
-rwxr-xr-xdoc/invocations-http-server/server.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/doc/invocations-http-server/server.py b/doc/invocations-http-server/server.py
index 7121ec75..bb9d2260 100755
--- a/doc/invocations-http-server/server.py
+++ b/doc/invocations-http-server/server.py
@@ -22,6 +22,7 @@ import werkzeug.routing
import werkzeug.utils
from werkzeug.wrappers import Request, Response
+from werkzeug.middleware.shared_data import SharedDataMiddleware
def core_config(conf):
new_conf = {}
@@ -442,6 +443,13 @@ class InvocationServer:
return self.render("invocation.html", params)
+def create_app(logsdir, **kwargs):
+ app = InvocationServer(logsdir, **kwargs)
+ app = SharedDataMiddleware(app, {
+ '/static': os.path.join(os.path.dirname(__file__), 'static')
+ })
+ return app
+
if __name__ == '__main__':
import sys
from argparse import ArgumentParser
@@ -472,10 +480,10 @@ if __name__ == '__main__':
print("just-mr argument should be valid json, but %r is not: %s"
% (args.just_mr, e), file=sys.stderr)
sys.exit(1)
- app = InvocationServer(args.DIR,
- just_mr=just_mr,
- graph=args.graph,
- artifacts=args.artifacts,
- meta=args.meta,
- profile=args.profile)
+ app = create_app(args.DIR,
+ just_mr=just_mr,
+ graph=args.graph,
+ artifacts=args.artifacts,
+ meta=args.meta,
+ profile=args.profile)
make_server(args.interface, args.port, app).serve_forever()