-
Notifications
You must be signed in to change notification settings - Fork 3
/
http_server.py
executable file
·44 lines (36 loc) · 1.16 KB
/
http_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
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
#----------------------------------------------
# HTTP server for panel_gen
# Run with $sudo python http_server.py
#
# Web page created with Skeleton CSS framework
# http://www.getskeleton.com
#
# This is insecure. We must only make this
# available from inside of our network, and we probably shouldn't be
# letting visitors on to our private wifi anyway.
#
#-----------------------------------------------
from cheroot.wsgi import Server as WSGIServer, PathInfoDispatcher
from flask import render_template
import connexion
import logging
import panel_gen
app = connexion.App(__name__, specification_dir='api/')
app.add_api('swagger.yml')
# This starts the UI. Normally, when we import as
# a module, we don't want to start the UI and take
# over the user's screen unless specifically asked.
#panel_gen.start_ui()
@app.route('/', methods=['GET'])
def home():
return render_template('home.html')
d = PathInfoDispatcher({'/': app})
server = WSGIServer(('0.0.0.0', 5000), d)
if __name__ == '__main__':
try:
server.start()
except KeyboardInterrupt:
server.stop()
finally:
panel_gen.api_stop(switch="all", source="module")