#!/bin/bash # Run the ExamInsight backend server set -e # Get the directory where this script is located SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BACKEND_DIR="$(dirname "$SCRIPT_DIR")" cd "$BACKEND_DIR" # Load environment variables from .env if it exists if [ -f "../.env" ]; then export $(cat ../.env | grep -v '^#' | xargs) fi # Check if we're in a virtual environment, create one if not if [ -z "$VIRTUAL_ENV" ]; then if [ ! -d ".venv" ]; then echo "Creating virtual environment..." python3 -m venv .venv fi source .venv/bin/activate fi # Install dependencies echo "Installing dependencies..." pip install -q -e . # Run the server echo "Starting ExamInsight backend on http://127.0.0.1:8000" uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload