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.
67 lines
1.4 KiB
Markdown
67 lines
1.4 KiB
Markdown
# iTi-System
|
|
|
|
`iti-system` 是 `iTi-Flask` 的可选系统业务包。
|
|
|
|
它提供认证、用户、角色、菜单、部门、字典、配置、文件、日志、用户扩展属性等系统域能力。
|
|
引入即全量引入。
|
|
不提供模块选择。
|
|
不拆分 migration。
|
|
|
|
ERP Service 这类服务不需要依赖本包。
|
|
MES 这类主业务项目可以依赖本包。
|
|
|
|
## 安装
|
|
|
|
业务项目依赖:
|
|
|
|
```toml
|
|
dependencies = [
|
|
"iti-flask @ git+https://git.noahlan.cn/iti-framework/iTi-Flask.git@v0.1.1",
|
|
"iti-system @ git+https://git.noahlan.cn/iti-framework/iTi-System.git@v0.1.1",
|
|
]
|
|
```
|
|
|
|
本地开发:
|
|
|
|
```bash
|
|
uv sync --extra dev
|
|
uv run --extra dev pytest
|
|
uv run --extra dev mypy
|
|
```
|
|
|
|
## 使用
|
|
|
|
```python
|
|
from iti.applications import create_app
|
|
from iti_system import create_system_module
|
|
|
|
app = create_app(
|
|
modules=[
|
|
create_system_module(),
|
|
],
|
|
)
|
|
```
|
|
|
|
## 数据库迁移
|
|
|
|
业务项目只保留一条 Alembic migration 流。
|
|
系统 migration 同步到业务项目的 `migrations/versions`。
|
|
|
|
```bash
|
|
uv run python -m flask --app app.py iti-system migrations sync
|
|
uv run python -m flask --app app.py db upgrade
|
|
```
|
|
|
|
系统 migration 是全量系统表集合。
|
|
轻服务如果不需要系统表,应不依赖 `iti-system`。
|
|
|
|
## Seed
|
|
|
|
```bash
|
|
uv run python -m flask --app app.py iti-system seed system
|
|
```
|
|
|
|
seed 使用 Python 代码。
|
|
必须幂等。
|
|
不会重置已有管理员密码。
|