|
22 | 22 | from importlib import resources |
23 | 23 |
|
24 | 24 |
|
25 | | -def _cmd_serve(_args): |
| 25 | +def _cmd_serve(args): |
26 | 26 | from ceopardy import app, create_app, socketio |
27 | 27 |
|
28 | 28 | # WARNING: This app is not ready to be exposed on the network. |
29 | 29 | # Game host interface would be exposed. |
30 | 30 | create_app() |
31 | | - socketio.run(app, host="127.0.0.1", port=5000, debug=False) |
| 31 | + debug = getattr(args, "debug", False) |
| 32 | + host, port = "127.0.0.1", 5000 |
| 33 | + print(f"Ceopardy serving on http://{host}:{port}/") |
| 34 | + print(f" Viewer: http://localhost:{port}/") |
| 35 | + print(f" Host: http://localhost:{port}/host") |
| 36 | + if debug: |
| 37 | + print(" Debug: ON (verbose logging + auto-reload)") |
| 38 | + socketio.run(app, host=host, port=port, debug=debug) |
32 | 39 |
|
33 | 40 |
|
34 | 41 | def _walk(traversable, prefix=""): |
@@ -80,7 +87,12 @@ def _cmd_init(_args): |
80 | 87 | def main(argv=None): |
81 | 88 | parser = argparse.ArgumentParser(prog="ceopardy") |
82 | 89 | sub = parser.add_subparsers(dest="cmd") |
83 | | - sub.add_parser("serve", help="Run the Ceopardy server (default).") |
| 90 | + serve = sub.add_parser("serve", help="Run the Ceopardy server (default).") |
| 91 | + serve.add_argument( |
| 92 | + "--debug", |
| 93 | + action="store_true", |
| 94 | + help="Enable Flask debug mode (verbose logging + auto-reload).", |
| 95 | + ) |
84 | 96 | sub.add_parser( |
85 | 97 | "init", |
86 | 98 | help="Scaffold data/ and game-media/ in the current directory.", |
|
0 commit comments