部署

Sphinx 构建产物是静态 HTML,可以部署到 GitHub Pages、Read the Docs、Cloudflare Pages、Vercel 或任意静态文件服务器。

构建命令

cd docs
source .venv/bin/activate
pip install -r requirements.txt
make html

静态站点输出目录:

docs/build/html

推荐部署方式

Cloudflare Pages / Vercel

构建配置:

项目

Build command

cd docs && pip install -r requirements.txt && make html

Output directory

docs/build/html

Read the Docs

Read the Docs 很适合 Sphinx 文档中心,支持版本化、搜索和自动构建。仓库接入后,使用 docs/requirements.txt 安装依赖,并将 Sphinx 源目录设置为 docs/source

本地静态服务器

构建完成后可以本地预览:

cd docs/build/html
python3 -m http.server 8000

然后访问 http://localhost:8000/