AWS Resource Scanner 是一个用于扫描和报告AWS资源的Web应用程序,包含:
注意: Redis是可选的。如果没有安装Redis,应用会自动使用Mock模式,可以进行基本功能测试。
# 进入backend目录
cd backend
# Windows: 运行设置脚本
setup.bat
# Unix/Linux/macOS: 运行设置脚本
chmod +x setup.sh
./setup.sh
# 激活虚拟环境
# Windows:
activate_venv.bat
# Unix/Linux/macOS:
source activate_venv.sh
# 初始化数据库
python init_db.py
# 检查Redis连接 (可选)
python test_redis.py
# 启动Flask应用 (自动检测Redis)
python start_with_redis_check.py
# 或者直接启动 (如果确定Redis已配置)
python run.py
注意: 如果没有安装Redis,应用会自动切换到Mock模式,功能受限但可以进行基本测试。
Backend将运行在: http://localhost:5000
# 新开一个终端,进入frontend目录
cd frontend
# Windows: 运行设置脚本
setup.bat
# Unix/Linux/macOS: 运行设置脚本
chmod +x setup.sh
./setup.sh
# 启动开发服务器
yarn dev
Frontend将运行在: http://localhost:3000
admin / admin123cloud-reporter/
├── backend/ # Python Flask后端
│ ├── app/ # 应用代码
│ ├── config/ # 配置文件
│ ├── migrations/ # 数据库迁移
│ ├── tests/ # 测试文件
│ ├── venv/ # Python虚拟环境
│ ├── requirements.txt # Python依赖
│ ├── setup_venv.py # 环境设置脚本
│ ├── init_db.py # 数据库初始化
│ └── run.py # 应用入口
├── frontend/ # React前端
│ ├── src/ # 源代码
│ ├── node_modules/ # Node.js依赖
│ ├── package.json # 项目配置
│ ├── vite.config.ts # 构建配置
│ └── setup.bat/sh # 环境设置脚本
└── sample-reports/ # 示例报告文件
cd backend
# 激活虚拟环境
activate_venv.bat # Windows
source activate_venv.sh # Unix/Linux
# 启动开发服务器
python run.py
# 运行测试
pytest
# 数据库操作
python init_db.py --reset # 重置数据库
python init_db.py --with-demo # 创建示例数据
cd frontend
# 启动开发服务器
yarn dev
# 构建生产版本
yarn build
# 运行测试
yarn test
# 代码检查
yarn lint
POST /api/auth/login - 用户登录POST /api/auth/refresh - 刷新令牌POST /api/auth/logout - 用户登出GET /api/users - 获取用户列表POST /api/users - 创建用户PUT /api/users/{id} - 更新用户DELETE /api/users/{id} - 删除用户GET /api/credentials - 获取凭证列表POST /api/credentials - 创建凭证PUT /api/credentials/{id} - 更新凭证DELETE /api/credentials/{id} - 删除凭证GET /api/tasks - 获取任务列表POST /api/tasks - 创建扫描任务GET /api/tasks/{id} - 获取任务详情DELETE /api/tasks/{id} - 删除任务GET /api/reports - 获取报告列表GET /api/reports/download?id={id} - 下载报告FLASK_ENV=development
SECRET_KEY=your-secret-key
JWT_SECRET_KEY=your-jwt-secret-key
DATABASE_URL=sqlite:///dev.db
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/1
ENCRYPTION_KEY=your-encryption-key
VITE_API_BASE_URL=http://localhost:5000
VITE_APP_TITLE=AWS Resource Scanner
VITE_DEBUG=true
虚拟环境问题
# 重新创建虚拟环境
python setup_venv.py --clean
数据库问题
# 重置数据库
python init_db.py --reset
依赖问题
# 升级依赖
python setup_venv.py --upgrade
依赖安装失败
# 清理并重新安装
yarn cache clean
rm -rf node_modules yarn.lock
yarn install
端口冲突
# 使用不同端口
yarn dev --port 3001
构建失败
# 检查TypeScript错误
npx tsc --noEmit
cd backend
python verify_setup.py
cd frontend
node verify_setup.js
yarn buildbackend/README_VENV.md, frontend/README_SETUP.md🎉 环境设置完成,开始开发吧!