【发布时间】:2015-04-29 21:30:49
【问题描述】:
我正在使用 Sphinx 来自动记录烧瓶 api。一切似乎都很好,但我有一个非常奇怪的问题。问题可以绕过,但绕过并不理想。
当我运行 make html Sphinx 运行时
(env)vagrant@dweloDevEnv:~/make html
sphinx-build -E -a -b html -d _build/doctrees . _build/html
Running Sphinx v1.3.1
building [mo]: all of 0 po files
building [html]: all source files
updating environment: 1 added, 0 changed, 0 removed
* Running on http://127.0.0.1:9001/
* Restarting with reloader
Running Sphinx v1.3.1
building [mo]: all of 0 po files
building [html]: all source files
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index
在上述行中,sphinx 挂起。我已经离开了整整一分钟,但它不会继续。如果我用 cntrl + c 杀死该进程,该进程实际上似乎成功完成:
reading sources... [100%] index
^C
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents...
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
doneing output... [100%] index
writing output... [100%] index
generating indices... genindex
generating indices... genindex http-routingtable http-routingtable
writing additional pages... search
writing additional pages... search
copying static files...
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
copying extra files... done
dumping search index in English (code: en) ... done
build succeeded.
done
dumping object inventory... done
build succeeded.
如果我去检查输出目录,我确实找到了我的 api 的文档。伟大的!不幸的是,这种方法使我无法将进程嵌入到 shell 脚本中(因为我必须终止进程才能通过挂起)。我的第一个文件非常简单。我已将其包含在下面:
my_app.rst
Contents:
.. toctree::
:maxdepth: 2
.. autoflask:: my_api.run:api.app
:undoc-static:
:blueprints: v1_api
:include-empty-docstring:
我已经折腾了很长时间,似乎无法弄清楚出了什么问题。缺少任何有用的错误消息并没有使它变得更容易。过去有人遇到过这种情况吗?
【问题讨论】:
-
您检查过您的 init 代码吗? Sphinx 将导入它记录的 python 模块,我猜这些模块的初始阶段之一可能有问题。
标签: python flask python-sphinx autodoc