From d3d522ef99b974a8bac81cb7c8eb1216f3fc64d9 Mon Sep 17 00:00:00 2001 From: Dmitry Chumak Date: Tue, 6 Jun 2023 16:33:29 +0300 Subject: [PATCH] web part with autoreload --- Pipfile | 1 + Pipfile.lock | 10 +++++++++- main.py | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 main.py diff --git a/Pipfile b/Pipfile index dddeea2..ce461f6 100644 --- a/Pipfile +++ b/Pipfile @@ -6,6 +6,7 @@ name = "pypi" [packages] pillow = "9.5.0" requests = "*" +bottle = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index d8d004a..1f48fb3 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "22548ae00762b9b7bcdd00701e9ffe30358d1a942f9b9841e5c741b6a044017d" + "sha256": "fdf03a928f8ac6903da82f7aa3218459226d3dd77e93ad377c0f45da8e7d7d77" }, "pipfile-spec": 6, "requires": { @@ -16,6 +16,14 @@ ] }, "default": { + "bottle": { + "hashes": [ + "sha256:d6f15f9d422670b7c073d63bd8d287b135388da187a0f3e3c19293626ce034ea", + "sha256:e1a9c94970ae6d710b3fb4526294dfeb86f2cb4a81eff3a4b98dc40fb0e5e021" + ], + "index": "pypi", + "version": "==0.12.25" + }, "certifi": { "hashes": [ "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7", diff --git a/main.py b/main.py new file mode 100644 index 0000000..abf9b33 --- /dev/null +++ b/main.py @@ -0,0 +1,25 @@ +from bottle import route, run, template, static_file + +tpl = """ + + + + {{ image }} + + + + My Image + + +""" + +@route('///') +def index(scene, char_name): + image = f"{char_name}-{scene}.png" + return template(tpl, image=image) + +@route('/results/') +def server_static(filename): + return static_file(filename, root='results') + +run(host='localhost', port=8080)