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.
1.6 KiB
1.6 KiB
Copier 模板
copier-template 生成 FastAPI 业务后端骨架。
模板只引用框架包,不复制框架源码。
生成
./scripts/iti.sh make-app ../my-business-app my_business_app
cd ../my-business-app
./app.sh init
./app.sh serve 8000
Windows:
scripts\iti.cmd make-app ..\my-business-app my_business_app
cd ..\my-business-app
app.cmd init
app.cmd serve 8000
参数
| 参数 | 说明 |
|---|---|
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.pyconfig.pypyproject.tomlmigrations/- 示例 FastAPI 模块
- 示例 SQLAlchemy 模型
- 示例测试
app.shapp.cmd
系统业务
选择 include_system=true 时,模板会注册 create_system_module()。
生成后执行:
./app.sh init-system
Windows:
app.cmd init-system
生成项目脚本
模板会生成两份脚本:
app.sh:Linux / macOS / Git Bash。app.cmd:Windows CMD。
常用命令:
./app.sh help
./app.sh install
./app.sh test
./app.sh serve 8000
./app.sh migration "alice add order table"
./app.sh migrate
带 iti-system 的项目还会有:
./app.sh system-sync
./app.sh system-seed
./app.sh init-system