huhan3000/scripts/serve_docs.sh

33 lines
874 B
Bash
Executable File

#!/bin/bash
# 胡汉三千年项目文档服务器
# Hu-Han Three Thousand Years Project Documentation Server
echo "🚀 启动胡汉三千年项目文档服务器..."
# 检查文档是否已构建
if [ ! -d "documentation/sphinx-docs/_build/html" ]; then
echo "📚 文档尚未构建,正在构建..."
./build_docs.sh
fi
# 进入文档目录
cd documentation/sphinx-docs/_build/html
# 获取本机IP地址
LOCAL_IP=$(hostname -I | awk '{print $1}')
echo "📖 文档服务器启动成功!"
echo ""
echo "🌐 访问地址:"
echo " 本地访问: http://localhost:8000"
echo " 局域网访问: http://$LOCAL_IP:8000"
echo ""
echo "💡 提示:"
echo " - 按 Ctrl+C 停止服务器"
echo " - 修改文档后需要重新构建: ./build_docs.sh"
echo ""
echo "🎉 正在启动服务器..."
# 启动Python HTTP服务器
python3 -m http.server 8000