web part with autoreload
This commit is contained in:
1
Pipfile
1
Pipfile
@@ -6,6 +6,7 @@ name = "pypi"
|
|||||||
[packages]
|
[packages]
|
||||||
pillow = "9.5.0"
|
pillow = "9.5.0"
|
||||||
requests = "*"
|
requests = "*"
|
||||||
|
bottle = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
|
|||||||
10
Pipfile.lock
generated
10
Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "22548ae00762b9b7bcdd00701e9ffe30358d1a942f9b9841e5c741b6a044017d"
|
"sha256": "fdf03a928f8ac6903da82f7aa3218459226d3dd77e93ad377c0f45da8e7d7d77"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -16,6 +16,14 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
|
"bottle": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:d6f15f9d422670b7c073d63bd8d287b135388da187a0f3e3c19293626ce034ea",
|
||||||
|
"sha256:e1a9c94970ae6d710b3fb4526294dfeb86f2cb4a81eff3a4b98dc40fb0e5e021"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.12.25"
|
||||||
|
},
|
||||||
"certifi": {
|
"certifi": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7",
|
"sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7",
|
||||||
|
|||||||
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