web part with autoreload
This commit is contained in:
25
main.py
Normal file
25
main.py
Normal 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)
|
||||
Reference in New Issue
Block a user