-
Notifications
You must be signed in to change notification settings - Fork 2
/
web.py
39 lines (29 loc) · 854 Bytes
/
web.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
# web client (async viever)
import os, sys
import config
from metaL import *
import flask
app = flask.Flask(__name__)
@app.route('/')
def index():
return flask.render_template('index.html', vm=vm, ctx=vm)
@app.route('/<path:path>.png')
def png(path):
return app.send_static_file(path + '.png')
@app.route('/<path:path>.jpg')
def jpg(path):
return app.send_static_file(path + '.jpg')
@app.route('/<path:path>.css')
def css(path):
return app.send_static_file(path + '.css')
@app.route('/<path:path>.js')
def js(path):
return app.send_static_file(path + '.js')
@app.route('/<path:path>')
def path(path):
ctx = vm
for i in path.split('/'):
ctx = ctx[i]
return flask.render_template('index.html', vm=vm, ctx=ctx)
app.run(host=config.HTTP_HOST, port=config.HTTP_PORT,
debug=True, extra_files=sys.argv)