Skip to content

Commit

Permalink
+ web.py (async system browser)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Ponyatov <ponyatov@meteo.local>
  • Loading branch information
Dmitry Ponyatov committed Jul 9, 2020
1 parent 1c5c32b commit bdda215
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static/bootstrap.js:
.PHONY: master shadow release

MERGE = Makefile README.md .gitignore .vscode apt.txt requirements.txt
MERGE += $(MODULE).py test_$(MODULE).py $(MODULE).ini static templates config.py
MERGE += $(MODULE).py test_$(MODULE).py $(MODULE).ini web.py static templates config.py

master:
git checkout $@
Expand Down
39 changes: 39 additions & 0 deletions web.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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_IP, port=config.HTTP_PORT,
debug=True, extra_files=sys.argv)

0 comments on commit bdda215

Please sign in to comment.