diff --git a/requirements.txt b/requirements.txt index b315279c..21e6dd4b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,6 @@ rich==14.0.0 ssdp==1.3.0 textual==2.1.2 textual-slider==0.2.0 +textual-serve==1.1.2 xmltodict==0.14.2 rich_click==1.8.8 diff --git a/src/main_web.py b/src/main_web.py new file mode 100644 index 00000000..38121e19 --- /dev/null +++ b/src/main_web.py @@ -0,0 +1,14 @@ +import os +from textual_serve.server import Server + +command = "python3 main_tui.py" +host = os.environ.get("WEB_HOST", "127.0.0.1") +port = int(os.environ.get("WEB_PORT", 8000)) +public_url = os.environ.get("WEB_URL") # e.g. "https://myapp.example.com" + +server_kwargs = {"host": host, "port": port} +if public_url: + server_kwargs["public_url"] = public_url + +server = Server(command, **server_kwargs) +server.serve(debug=False) # generates a textual.log debug file when True