fix: use uvicorn directly without reload mode for backend startup
- Fix backend process dying immediately after startup - Change from 'python -m app.main' to 'uvicorn app.main:app' - Remove reload mode for stable background operation - Resolve 'connect ECONNREFUSED 127.0.0.1:8000' error Problem: - Backend used reload=settings.DEBUG mode - reload mode conflicts with nohup background running - Process management became unstable - Backend service stopped immediately after startup Solution: - Use uvicorn command directly without reload - Single process mode, stable background operation - Suitable for production environment Files: - start.sh: updated backend startup command - docs/BACKEND_FIX.md: fix documentation
This commit is contained in:
2
start.sh
2
start.sh
@@ -68,7 +68,7 @@ fi
|
||||
echo -e "${GREEN}启动后端服务...${NC}"
|
||||
cd "$BACKEND_DIR"
|
||||
source venv/bin/activate
|
||||
nohup python -m app.main >> "$BACKEND_LOG" 2>&1 &
|
||||
nohup uvicorn app.main:app --host 0.0.0.0 --port 8000 >> "$BACKEND_LOG" 2>&1 &
|
||||
BACKEND_PID=$!
|
||||
echo "$BACKEND_PID" >> "$PID_FILE"
|
||||
echo -e " PID: $BACKEND_PID"
|
||||
|
||||
Reference in New Issue
Block a user