Skip to content

Commit 449e2c7

Browse files
committed
UX: Improve startup logs to clarify localhost access when binding to 0.0.0.0
1 parent 09959dc commit 449e2c7

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

webapp/app.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,22 @@ def main():
5353
Output("post-js-scripts", "children"),
5454
Input("post-js-scripts", "id"),
5555
)
56+
# Provide user-friendly access instructions
57+
host = os.getenv("HOST", "127.0.0.1")
58+
port = os.getenv("PORT", "8050")
59+
60+
print("\n" + "=" * 50)
61+
print("NetMedEx Web Application Starting...")
62+
if host == "0.0.0.0":
63+
print(f"Listening on all interfaces (0.0.0.0:{port})")
64+
print(f"👉 To access the app, open: http://localhost:{port}")
65+
else:
66+
print(f"👉 Access the app at: http://{host}:{port}")
67+
print("=" * 50 + "\n")
68+
5669
app.run(
57-
host=os.getenv("HOST", "127.0.0.1"),
58-
port=os.getenv("PORT", "8050"),
70+
host=host,
71+
port=port,
5972
debug=(os.getenv("FLASK_DEBUG") == "true"),
6073
)
6174
finally:

0 commit comments

Comments
 (0)