summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2026-07-01 09:46:39 +0300
committerJan Tuomi <jan@jantuomi.fi>2026-07-01 09:46:39 +0300
commit4c1b4060a5fb9e020765360d212d65c543c3ce1b (patch)
tree470d6dffa834fe2ec0ee66a61a1bb4acd5dea55a
parente0d6813ae0e6b93f3e6caa3015ab519d3632037d (diff)
Add HOST and PORT
-rw-r--r--app.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/app.py b/app.py
index dbeeae2..efbd1b1 100644
--- a/app.py
+++ b/app.py
@@ -13,6 +13,8 @@ from urllib.parse import parse_qs, urlparse
DB = "expenses.db"
PAGE_SIZE = 20
BASE_URL = os.environ.get("EXPENSES_BASE_URL", "http://localhost:8000").rstrip("/")
+HOST = os.environ.get("HOST", "0.0.0.0")
+PORT = int(os.environ.get("PORT", "8000"))
def get_db():
@@ -445,7 +447,6 @@ class Handler(BaseHTTPRequestHandler):
if __name__ == "__main__":
init_db()
- port = 8000
- print(f"Running on http://localhost:{port}")
- print("Visit http://localhost:{}/new to create a group".format(port))
- HTTPServer(("", port), Handler).serve_forever()
+ print(f"Running on http://{HOST}:{PORT}")
+ print(f"Visit http://{HOST}:{PORT}/new to create a group")
+ HTTPServer((HOST, PORT), Handler).serve_forever()