使用Sphinx生成项目的Read the Docs

  1. 环境配置
# pip install sphinx sphinx_rtd_theme
  1. 原始代码目录
# tree
文件夹 PATH 列表
卷序列号为 0007-1DAC
D:.
├─web
      └─web_gzip.py
  1. 创建api文档
# 在代码目录中创建doc目录,存放相应的信息
# sphinx-apidoc -o ./doc/ . 
Creating file ./doc/web_gzip.rst.
Creating file ./doc/modules.rst.
  1. 运行sphinx-quictstart
# sphinx-quickstart

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-6f1b44ecc2a2000d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-08d3b9b96c02c521.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


5. 修改conf.py
在最开始处加入rtd theme相关配置

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-3736a4fdf31fec7e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

同时要注释原来的theme设置

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-15b23c25776f56d5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)



6. 修改index.rst

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-3b88ded88b38e46f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

7. 执行make.bat html

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-0ca6237c8e8a0cf6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

8. 查看

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-8dd5ac2acc42f835.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-8d9d7cd4df1a4026.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/6800605-67e937b6f8f0374b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

你可能感兴趣的:(使用Sphinx生成项目的Read the Docs)