# 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 |