forked from hltcoe/concrete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconcrete_docs_server.py
executable file
·34 lines (23 loc) · 1.03 KB
/
concrete_docs_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""Webserver that serves static files in 'docs/schema/' directory"""
import argparse
import os
from bottle import route, run, static_file
def main():
parser = argparse.ArgumentParser(description='Provide an easy-to-read API to Concrete')
parser.add_argument('--port', '-p', dest='port', action='store',
default = 8097, type=int,
help = 'Port on which to run server')
parser.add_argument('--host', dest='host', action='store',
default = 'localhost', type=str,
help = 'Host on which to listen on')
args = parser.parse_args()
run(host=args.host, port=args.port)
@route('/')
def index():
return static_file('index.html', root=os.path.join(os.path.dirname(os.path.abspath(__file__)), "docs/schema"))
@route('<filepath:path>')
def default_route(filepath):
return static_file(filepath, root=os.path.join(os.path.dirname(os.path.abspath(__file__)), "docs/schema"))
if __name__ == "__main__":
main()