mirror of
https://github.com/handsomezhuzhu/QQuiz.git
synced 2026-02-20 12:00:14 +00:00
🔧 Fix frontend warnings and add diagnostic tools
Fix: - Add type: module to package.json to eliminate ES module warning - Create separate backend/frontend startup scripts - Add system status check tool New files: - check_status.bat: Diagnose system status - start_backend_only.bat: Start backend separately - start_frontend_only.bat: Start frontend separately 🚀 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
87
check_status.bat
Normal file
87
check_status.bat
Normal file
@@ -0,0 +1,87 @@
|
||||
@echo off
|
||||
title QQuiz - System Status Check
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo QQuiz System Status Check
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
echo [1] Checking Python...
|
||||
python --version
|
||||
if %errorlevel% neq 0 (
|
||||
echo ERROR: Python not found!
|
||||
) else (
|
||||
echo OK
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [2] Checking Node.js...
|
||||
node --version
|
||||
if %errorlevel% neq 0 (
|
||||
echo ERROR: Node.js not found!
|
||||
) else (
|
||||
echo OK
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [3] Checking PostgreSQL...
|
||||
psql --version
|
||||
if %errorlevel% neq 0 (
|
||||
echo WARNING: PostgreSQL command not found in PATH
|
||||
) else (
|
||||
echo OK
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [4] Checking if backend is running...
|
||||
curl -s http://localhost:8000/health >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo ERROR: Backend is NOT running on port 8000
|
||||
echo.
|
||||
echo Backend must be started first!
|
||||
echo Run the backend window manually:
|
||||
echo cd backend
|
||||
echo venv\Scripts\activate.bat
|
||||
echo uvicorn main:app --reload
|
||||
) else (
|
||||
echo OK - Backend is running
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [5] Checking if frontend is running...
|
||||
curl -s http://localhost:3000 >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo WARNING: Frontend is NOT running on port 3000
|
||||
) else (
|
||||
echo OK - Frontend is running
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [6] Checking ports...
|
||||
echo Checking port 8000 (Backend):
|
||||
netstat -ano | findstr :8000
|
||||
echo.
|
||||
echo Checking port 3000 (Frontend):
|
||||
netstat -ano | findstr :3000
|
||||
echo.
|
||||
|
||||
echo [7] Checking .env configuration...
|
||||
if exist ".env" (
|
||||
echo OK - .env file exists
|
||||
findstr /C:"OPENAI_API_KEY=sk-" .env >nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo WARNING: OPENAI_API_KEY may not be configured properly
|
||||
) else (
|
||||
echo OK - API Key appears to be configured
|
||||
)
|
||||
) else (
|
||||
echo ERROR: .env file not found!
|
||||
)
|
||||
echo.
|
||||
|
||||
echo ========================================
|
||||
echo Diagnosis Complete
|
||||
echo ========================================
|
||||
echo.
|
||||
pause
|
||||
2928
frontend/package-lock.json
generated
Normal file
2928
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "qquiz-frontend",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"description": "QQuiz Frontend - React Application",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
||||
44
start_backend_only.bat
Normal file
44
start_backend_only.bat
Normal file
@@ -0,0 +1,44 @@
|
||||
@echo off
|
||||
title QQuiz Backend Server
|
||||
color 0B
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Starting QQuiz Backend Server
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd /d "%~dp0backend"
|
||||
|
||||
if not exist "venv\Scripts\activate.bat" (
|
||||
echo Creating virtual environment...
|
||||
python -m venv venv
|
||||
)
|
||||
|
||||
echo Activating virtual environment...
|
||||
call venv\Scripts\activate.bat
|
||||
|
||||
echo.
|
||||
echo Installing/updating dependencies...
|
||||
pip install -q -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
echo.
|
||||
echo Running database migrations...
|
||||
alembic upgrade head
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Backend Server Starting...
|
||||
echo ========================================
|
||||
echo.
|
||||
echo API URL: http://localhost:8000
|
||||
echo API Docs: http://localhost:8000/docs
|
||||
echo Health: http://localhost:8000/health
|
||||
echo.
|
||||
echo Press Ctrl+C to stop
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
||||
|
||||
pause
|
||||
34
start_frontend_only.bat
Normal file
34
start_frontend_only.bat
Normal file
@@ -0,0 +1,34 @@
|
||||
@echo off
|
||||
title QQuiz Frontend Server
|
||||
color 0B
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Starting QQuiz Frontend Server
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd /d "%~dp0frontend"
|
||||
|
||||
if not exist "node_modules" (
|
||||
echo Installing dependencies (first time only)...
|
||||
call npm config set registry https://registry.npmmirror.com
|
||||
call npm install
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Frontend Server Starting...
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Frontend URL: http://localhost:3000
|
||||
echo.
|
||||
echo Make sure backend is running on port 8000!
|
||||
echo.
|
||||
echo Press Ctrl+C to stop
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
npm start
|
||||
|
||||
pause
|
||||
Reference in New Issue
Block a user