|
|
|
|
@ -30,11 +30,14 @@ CREATE DATABASE my_business_app_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unico
|
|
|
|
|
执行:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
export DATABASE_URL='mysql+pymysql://root:password@127.0.0.1:3306/iti_test?charset=utf8mb4'
|
|
|
|
|
uv run python -m alembic upgrade head
|
|
|
|
|
uv run iti-system migrations sync --target migrations/versions
|
|
|
|
|
PYTHONPATH=. uv run iti-system seed system app:create_app
|
|
|
|
|
uv run uvicorn main:app --reload
|
|
|
|
|
DATABASE_URL=mysql+pymysql://root:password@127.0.0.1:3306/iti_test?charset=utf8mb4
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
把连接串写入业务项目 `.env.local` 后执行:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
iticli init system
|
|
|
|
|
iticli run dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## PostgreSQL 集成验证
|
|
|
|
|
@ -49,9 +52,14 @@ CREATE DATABASE my_business_app_test;
|
|
|
|
|
执行:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
export DATABASE_URL='postgresql+psycopg://postgres:password@127.0.0.1:5432/iti_test'
|
|
|
|
|
uv run python -m alembic upgrade head
|
|
|
|
|
uv run uvicorn main:app --reload
|
|
|
|
|
DATABASE_URL=postgresql+psycopg://postgres:password@127.0.0.1:5432/iti_test
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
把连接串写入业务项目 `.env.local` 后执行:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
iticli migrate
|
|
|
|
|
iticli run dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
验证:
|
|
|
|
|
@ -68,12 +76,13 @@ curl http://127.0.0.1:8000/ready
|
|
|
|
|
模板生成项目已经包含 Docker Compose:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cp .env.example .env
|
|
|
|
|
iticli docker up
|
|
|
|
|
iticli docker logs
|
|
|
|
|
iticli docker down
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
`iticli docker ...` 会在 `.env` 不存在时从 `.env.example` 创建。
|
|
|
|
|
|
|
|
|
|
如需本地数据库:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|