From 10124147bfcb5e87549eec1deca6f2f43ab22234 Mon Sep 17 00:00:00 2001 From: Abhishek Dasgupta Date: Wed, 6 Nov 2024 16:49:08 +0000 Subject: [PATCH] Add support for running arcmapper in debug mode --- README.md | 3 +++ src/arcmapper/__init__.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index c8df7c8..e910d22 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ uv sync uv run arcmapper ``` +This will run arcmapper in production mode. During development it is helpful to +see debug information, to do so run arcmapper with the `-d` or `--debug` flag. + ## Usage The browser should open with the ARCMapper interface diff --git a/src/arcmapper/__init__.py b/src/arcmapper/__init__.py index 2f77327..d5ca4f8 100644 --- a/src/arcmapper/__init__.py +++ b/src/arcmapper/__init__.py @@ -1,4 +1,5 @@ import os +import sys import time import socket import logging @@ -60,6 +61,10 @@ def wait_for_server( def main(): + if len(sys.argv) > 1 and sys.argv[1] in ["--debug", "-d"]: + print("Using debug mode...") + app.run_server(debug=True) + return if check_port(ARCMAPPER_HOST, ARCMAPPER_PORT): logging.info("Port is already in use. Opening browser.") webbrowser.open(f"http://{ARCMAPPER_HOST}:{ARCMAPPER_PORT}")