- Add src/university_scraper module with scraper, analyzer, and CLI - Add backend FastAPI service with API endpoints and database models - Add frontend React app with university management pages - Add configs for Harvard, Manchester, and UCL universities - Add artifacts with various scraper implementations - Add Docker compose configuration for deployment - Update .gitignore to exclude generated files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
启动后端API服务 (本地开发)
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
# 切换到项目根目录
|
|
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
os.chdir(project_root)
|
|
|
|
# 添加backend到Python路径
|
|
backend_path = os.path.join(project_root, "backend")
|
|
sys.path.insert(0, backend_path)
|
|
|
|
print("=" * 60)
|
|
print("启动大学爬虫 Web API 服务")
|
|
print("=" * 60)
|
|
print(f"项目目录: {project_root}")
|
|
print(f"后端目录: {backend_path}")
|
|
print()
|
|
|
|
# 检查是否安装了依赖
|
|
try:
|
|
import fastapi
|
|
import uvicorn
|
|
except ImportError:
|
|
print("正在安装后端依赖...")
|
|
subprocess.run([sys.executable, "-m", "pip", "install", "-r", "backend/requirements.txt"])
|
|
|
|
# 初始化数据库
|
|
print("初始化数据库...")
|
|
os.chdir(backend_path)
|
|
|
|
# 启动服务
|
|
print()
|
|
print("启动 FastAPI 服务...")
|
|
print("API文档: http://localhost:8000/docs")
|
|
print("Swagger UI: http://localhost:8000/redoc")
|
|
print()
|
|
|
|
import uvicorn
|
|
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=True)
|