web part with autoreload

This commit is contained in:
2023-06-06 16:33:29 +03:00
parent ff0229b6a3
commit d3d522ef99
3 changed files with 35 additions and 1 deletions

25
main.py Normal file
View File

@@ -0,0 +1,25 @@
from bottle import route, run, template, static_file
tpl = """
<!DOCTYPE html>
<html>
<head>
<title>{{ image }}</title>
<meta http-equiv="refresh" content="30">
</head>
<body>
<img src="/results/{{ image }}" alt="My Image">
</body>
</html>
"""
@route('/<scene>/<char_name>/')
def index(scene, char_name):
image = f"{char_name}-{scene}.png"
return template(tpl, image=image)
@route('/results/<filename>')
def server_static(filename):
return static_file(filename, root='results')
run(host='localhost', port=8080)