Files
adcloud-server/README.md
T

32 lines
749 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Python 后端服务器
使用 FastAPI 开发,依赖和虚拟环境统一由 **uv** 管理。
## 开发
```sh
uv sync
uv run uvicorn backend_server.main:app --reload --host 127.0.0.1 --port 8000
```
- 健康检查:`http://localhost:8000/health`
- API 文档:`http://localhost:8000/docs`
- OpenAPI:`http://localhost:8000/openapi.json`
默认允许来自 `http://localhost:3000`、`http://localhost:5173` 的浏览器请求。
通过环境变量配置逗号分隔的允许来源:
```sh
CORS_ORIGINS=https://your-frontend.example uv run uvicorn backend_server.main:app
```
## 检查
```sh
uv run pytest
uv run ruff check .
uv run ruff format --check .
```
提交 `uv.lock`,在其他电脑使用 `uv sync --locked` 复现依赖。