portal/README.md
Hermes Agent ae06dda9da feat: portal webapp - CMS独立Web应用壳
- app/portal.py: 主入口,通过from cms.init import load_cms加载业务模块
- conf/config.json: 应用配置(ocai_cms数据库, 端口9090, cms模块wwwroot挂载到/cms)
- wwwroot/: 公开页面(index/news/cases/products)和公开API
- build.sh: 构建脚本(安装基础设施包+pip install cms模块+DDL/CRUD生成)
- deploy.sh: 一键部署脚本(构建→建表→初始数据→权限→启动)
- init_data.py: 从cms模块init/data.yaml加载初始数据
- init_any/superuser_permissions.py: RBAC权限初始化
2026-06-15 11:06:10 +08:00

81 lines
3.0 KiB
Markdown
Raw Permalink 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.

# Portal — 企业官网CMS独立Web应用
基于Sage/bricks-framework的独立Web应用通过pip install加载cms业务模块。
## 架构
```
Portal (Web应用壳) CMS (业务模块)
┌─────────────────────┐ ┌──────────────────────┐
│ app/portal.py │────>│ cms/init.py │
│ load_cms() │ │ load_cms() │
│ │ │ - CMS CRUD │
│ wwwroot/ │ │ - DD审批 │
│ index.ui (官网) │ │ │
│ news.ui │ │ wwwroot/ │
│ api/ (公开API) │ │ admin.ui │
│ │ │ api/ (管理API) │
│ conf/config.json │ │ │
│ build.sh │ │ models/ json/ init/ │
│ deploy.sh │ │ data.yaml │
└─────────────────────┘ └──────────────────────┘
```
## 快速开始
```bash
# 一键部署
cd ~/repos/portal && ./deploy.sh
# 或分步执行:
./build.sh # 构建
mysql -h db -u test -p ocai_cms < cms.ddl.sql # 建表
py3/bin/python init_data.py # 初始数据
py3/bin/python init_superuser_permissions.py # 权限
py3/bin/python init_any_permissions.py
py3/bin/python ~/repos/cms/scripts/load_path.py
./start.sh # 启动
```
## 目录结构
```
portal/
├── app/
│ ├── portal.py # 主入口 (from cms.init import load_cms)
│ └── global_func.py # 全局函数
├── conf/config.json # 应用配置 (数据库ocai_cms, 端口9090)
├── wwwroot/ # 公开页面
│ ├── index.ui # 官网首页
│ ├── products.ui # 产品架构
│ ├── news.ui / news_detail.ui
│ ├── cases.ui # 成功案例
│ ├── admin.ui # 管理后台入口
│ └── api/ # 公开只读API
│ ├── get_published_content.dspy
│ ├── get_content_detail.dspy
│ ├── get_config.dspy
│ ├── get_sections.dspy
│ └── submit_lead.dspy
├── build.sh # 构建脚本
├── deploy.sh # 一键部署
├── init_data.py # 加载初始数据
├── init_any_permissions.py # 匿名权限
└── init_superuser_permissions.py
```
## CMS模块
CMS业务模块位于 `~/repos/cms/`,通过 `pip install -e` 安装。
详见 [CMS模块README](../cms/README.md)。
## 访问地址
| 页面 | URL |
|------|-----|
| 官网首页 | http://localhost:9090/ |
| 产品架构 | /products.ui |
| 新闻动态 | /news.ui |
| 成功案例 | /cases.ui |
| 管理后台 | /cms/admin.ui |