#!/bin/bash # Exit on error set -e # Get the absolute path of the script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" # Add project root and app directory to Python path export PYTHONPATH="${PROJECT_ROOT}:${PROJECT_ROOT}/app:${PYTHONPATH:-}" # Create storage directory if it doesn't exist mkdir -p "${PROJECT_ROOT}/app/storage" # Print current working directory and Python path for debugging echo "Current directory: $(pwd)" echo "PYTHONPATH: ${PYTHONPATH}" echo "Project root: ${PROJECT_ROOT}" # Run database migrations echo "Running database migrations..." python "${SCRIPT_DIR}/migrate.py" # Start the FastAPI application with uvicorn echo "Starting FastAPI application..." uvicorn app.main:app --host 0.0.0.0 --port 7860 --reload