tanbushi's picture
Sun Jun 8 15:02:12 CST 2025
b7791c2
|
raw
history blame
1.24 kB

技术背景 (Tech Context)

使用的技术

  • 后端框架: FastAPI (Python)
  • 数据库: SQLite
  • ORM: SQLAlchemy
  • 异步 SQLite 驱动: aiosqlite
  • 异步 HTTP 客户端: httpx
  • 配置管理: 数据库用于存储代理规则和 Key 信息。
  • 依赖管理: pip 和 requirements.txt
  • 容器化: Docker

开发环境设置

  1. 克隆仓库。
  2. 创建并激活 Conda 虚拟环境 (conda create -n api-proxy python=3.9 或使用现有环境,然后 conda activate api-proxy)。
  3. 安装依赖 (pip install -r requirements.txt)。
  4. 创建数据库: 运行数据库初始化脚本或命令(例如 sqlite3 ./api_proxy.db "...")。
  5. 运行应用 (uvicorn app:app --reload)。

技术约束

  • 需要 Python 3.7+。
  • 依赖于 FastAPI, httpx, SQLAlchemy, aiosqlite 库。

依赖关系

  • requirements.txt 文件列出了所有必要的 Python 依赖,包括 FastAPI, httpx, SQLAlchemy, aiosqlite。

工具使用模式

  • 使用 uvicorn 作为 ASGI 服务器运行 FastAPI 应用。
  • 使用 pip 管理 Python 包。
  • 使用 Docker 构建和运行容器。
  • 使用 sqlite3 命令或 SQLAlchemy 进行数据库管理。
  • 使用 pytest 运行单元测试。