我知道下面的代码为所有模块生成rst,但不包括index.rst
sphinx-apidoc -f -o very_good_docs/ very_good下面的代码生成所有内容,包括index.rst、conf.py、Makefile等
sphinx-apidoc -F -f -o very_good_docs/ very_good问题是sphinx-apidoc不能生成正确的conf.py,所以我必须总是手动修改conf.py以包含正确的sys.paths。如果我在"very_good“文件夹中修改我的python代码,我应该运行不带"-F”的sphinx-apidoc命令,这样conf.py就会被保留。但是,如果我直接在very_good下添加一个新模块,如果没有"-F“选项,index.rst不会更新,这意味着我的新模块将不会出现在文档中。我猜解决方案是要么有人只生成index.rst文件,要么使用"-F“选项而不覆盖conf.py。有办法做到这一点吗?
发布于 2015-02-19 20:02:07
这就是我现在正在经历的事情。找不到信息来实现如此常见的事情真的很令人沮丧。
我的方法是使用一个自定义的config.py,并指定它always I execute sphinx-build with -F选项。这样,即使创建了一个新的(无用的) config.py,我的config.py也不会被覆盖。
为了指定自定义config.py,您应该使用文档中所述的-c选项:
-c path
Don’t look for the conf.py in the source directory, but use the given configuration directory instead. Note that various other files and paths given by configuration values are expected to be relative to the configuration directory, so they will have to be present at this location too.
New in version 0.3.该命令将如下所示:
sphinx-build -b html -c %sphinxConfigDir% %sourceCode% %buildDir%https://stackoverflow.com/questions/21842380
复制相似问题