-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
36 lines (28 loc) · 999 Bytes
/
app.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
import os, sys
pwd = os.path.dirname(__file__)
print pwd
print __file__
print os.listdir(pwd)
sys.path.append(pwd)
sys.path.append(pwd + "/app/")
from bottle import get, post, run, request, response, template, static_file, default_app
from urtserver import get_server_info
@get('/')
def index():
return static_file('index.html',root= pwd + '/views/')
@get('/static/<filepath:path>')
def server_static(filepath):
return static_file(filepath, root= pwd + '/static/')
@get('/getconfig')
def getconfig():
response.set_header('Content-Type' , 'application/javascript')
return 'configured_server_list = %s' % open( pwd + '/config.json').read()
@post('/getstatus')
def getconfig():
urt_id = request.forms.get('id')
urt_host = request.forms.get('host')
urt_port = request.forms.get('port')
return get_server_info(urt_id, urt_host, urt_port)
#run(host='0.0.0.0', port=8080, debug = True)
#run(host='localhost', port=5000, server='gunicorn', workers=4)
application = app = default_app()