-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dmitry Ponyatov <ponyatov@meteo.local>
- Loading branch information
Dmitry Ponyatov
committed
Jul 9, 2020
1 parent
1c5c32b
commit bdda215
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |