From f43c32c72b5c075c8fd06706fcb5f842945a48b2 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 17 Aug 2026 12:28:54 +0200 Subject: [PATCH] update server helper --- backend/start_server.sh | 35 +++++++++++++++++++++++++++++++++-- requirements.txt | 6 ++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 requirements.txt diff --git a/backend/start_server.sh b/backend/start_server.sh index f081e9a..6d8a726 100755 --- a/backend/start_server.sh +++ b/backend/start_server.sh @@ -1,14 +1,45 @@ #!/bin/bash +set -e + +VENV="" + +for dir in .venv venv env; do + if [ -f "$dir/bin/activate" ]; then + VENV="$dir" + break + fi +done + +if [ -z "$VENV" ]; then + echo "ERROR: No virtual environment found." + echo "Expected .venv/, venv/ or env/" + exit 1 +fi + +echo "Using virtual environment: $VENV" + +source "$VENV/bin/activate" + +if [ ! -f requirements.txt ]; then + echo "ERROR: requirements.txt not found." + exit 1 +fi + +echo "Checking requirements..." +python -m pip install -r requirements.txt + case "$1" in local) echo "Starting Calendar API locally..." - python3 -m uvicorn main:app --reload + python -m uvicorn main:app --reload ;; + lan) echo "Starting Calendar API on LAN..." - python3 -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload + python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload ;; + *) echo "Usage: $0 {local|lan}" echo " local Start locally" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e99d040 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +bcrypt +python-jose +python-dotenv +fastapi +pydantic +uvicorn \ No newline at end of file