From b0793b8a86d8cb101029756705ca3b3e8dd7a8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Fri, 29 May 2026 01:13:32 +0300 Subject: [PATCH] add support for running the server on local network in debug --- README.md | 5 ++--- app/run.py | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1eba7fd..b8844fc 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,10 @@ $ pip install -r requirements.txt 4. run dev server: ```bash -$ python -m app.run +$ python -m app.run -d ``` -the server will run on localhost:8080. when run for the first time, it will create an admin account and print its credentials to the terminal, so make sure to run this in an interactive session. +the server will run on localhost:8080 (and will be available on the local network as well; if this is not desired, drop the `-d` flag). when run for the first time, it will create an admin account and print its credentials to the terminal, so make sure to run this in an interactive session. press Ctrl+C to stop the server. @@ -110,4 +110,3 @@ when you want to run the server again, make sure to activate the venv first: $ source .venv/bin/activate $ python -m app.run ``` - diff --git a/app/run.py b/app/run.py index eb66f73..e567306 100644 --- a/app/run.py +++ b/app/run.py @@ -1,10 +1,15 @@ from app import create_app import os +import sys app = create_app() if __name__ == "__main__": + if len(sys.argv) > 1 and sys.argv[1] == '-d': + hostname = '0.0.0.0' + else: + hostname = '127.0.0.1' app.run( - host = "127.0.0.1", + host = hostname, port = 8080 )