Cause: You're using uvicorn directly instead of python -m uvicorn
Cause: You're running from the wrong directory (project root instead of backend)
Just double-click: start_backend.bat in the project root
Step 1: Open PowerShell or Command Prompt
Step 2: Navigate to backend directory:
cd "D:\COmplete project\demo\backend"Step 3: Run this EXACT command:
python -m uvicorn main:app --reload --port 8000IMPORTANT:
- β
Use
python -m uvicorn(NOT justuvicorn) - β
Make sure you're in the
backenddirectory - β
The command should show:
INFO: Uvicorn running on http://127.0.0.1:8000
# Check current directory
pwd
# Should show: D:\COmplete project\demo\backend
# List files - you should see main.py
dir
# Should show: main.py, database.py, etc.-
β Navigate to backend:
cd backend -
β Create database (if not done):
python create_database.py
-
β Initialize data (if not done):
python init_db.py
-
β Start server (USE THIS EXACT COMMAND):
python -m uvicorn main:app --reload --port 8000
After starting, open browser:
- http://localhost:8000/health β Should show
{"status": "healthy"} - http://localhost:8000/docs β Should show Swagger UI
β
CORRECT:
cd backend
python -m uvicorn main:app --reload --port 8000
β WRONG:
uvicorn main:app --reload --port 8000
python -m uvicorn main:app --reload --port 8000 (from project root)
I've created start_backend.bat - just double-click it and it will:
- Navigate to the right directory
- Start the server with correct command
- Show you any errors
Just double-click: start_backend.bat π