Files
tally/server.py

21 lines
584 B
Python

#!/usr/bin/env python3
"""Project runner: serves the expense tracker with zero dependencies."""
import functools
import http.server
import os
PORT = int(os.environ.get("PORT", "8000"))
HOST = os.environ.get("HOST", "0.0.0.0")
ROOT = os.path.dirname(os.path.abspath(__file__))
handler = functools.partial(
http.server.SimpleHTTPRequestHandler, directory=ROOT
)
server = http.server.ThreadingHTTPServer((HOST, PORT), handler)
print(
"Tally running at http://%s:%d (open http://localhost:%d in your browser)"
% (HOST, PORT, PORT),
flush=True,
)
server.serve_forever()