使用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)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容