You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
Markdown
51 lines
1.1 KiB
Markdown
# Copier 模板
|
|
|
|
`copier-template` 生成 FastAPI 业务后端骨架。
|
|
模板只引用框架包,不复制框架源码。
|
|
|
|
## 生成
|
|
|
|
```bash
|
|
uvx copier copy ./copier-template ../my-business-app
|
|
cd ../my-business-app
|
|
uv sync --extra dev
|
|
uv run alembic upgrade head
|
|
uv run uvicorn app:app --reload
|
|
```
|
|
|
|
## 参数
|
|
|
|
| 参数 | 说明 |
|
|
| --- | --- |
|
|
| `project_name` | 业务项目显示名称 |
|
|
| `project_slug` | 业务项目 Python 包名 |
|
|
| `framework_git` | iTi-Flask Git 地址 |
|
|
| `framework_tag` | iTi-Flask Git tag |
|
|
| `include_system` | 是否引入 iTi-System |
|
|
| `system_git` | iTi-System Git 地址 |
|
|
| `system_tag` | iTi-System Git tag |
|
|
|
|
默认推荐私有 Git tag。
|
|
允许改成 branch 或 `file://`,但多人协作项目不建议依赖本机路径。
|
|
|
|
## 生成内容
|
|
|
|
- `app.py`
|
|
- `config.py`
|
|
- `pyproject.toml`
|
|
- `migrations/`
|
|
- 示例 FastAPI 模块
|
|
- 示例 SQLAlchemy 模型
|
|
- 示例测试
|
|
|
|
## 系统业务
|
|
|
|
选择 `include_system=true` 时,模板会注册 `create_system_module()`。
|
|
生成后执行:
|
|
|
|
```bash
|
|
uv run iti-system migrations sync --target migrations/versions
|
|
uv run alembic upgrade head
|
|
uv run iti-system seed system app:app
|
|
```
|