add support for running the server on local network in debug

This commit is contained in:
2026-05-29 01:13:32 +03:00
parent dc1ff4446e
commit b0793b8a86
2 changed files with 8 additions and 4 deletions

View File

@@ -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 <kbd>Ctrl</kbd>+<kbd>C</kbd> 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
```

View File

@@ -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
)