python - sphinx 卡在阅读源上... [100%] 索引

标签 python flask python-sphinx autodoc

我使用 Sphinx 来自动记录 Flask 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:

我已经敲了很长时间了,似乎无法弄清楚出了什么问题。缺乏任何有用的错误消息并不会让事情变得更容易。以前有人遇到过这种情况吗?

最佳答案

问题最终是我实际上是在 my_app.py 文件中执行 api (app.run)。因此,虽然应用程序对象可用并最终得到解释,但我挂断了电话,因为 api 已上线。

关于python - sphinx 卡在阅读源上... [100%] 索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29954968/

相关文章:

css - 如何去除sphinx文档中对内部超链接的强调

python-sphinx - 是否可以将 graphviz 元素链接到 sphinx 链接?

python - 将 Pandas 数据框转换为字典

python - 从 zip 存档中提取单个文件而不遍历 Python 中的整个名称列表

python - 伪装类的真实模块

python - 在 ubuntu/apache2 : virtual host configuration 上部署 flask 应用程序

python-3.x - MongoEngine ReplicaSet 连接在降级时失败

Python Flask - 如何使用 SubmitField 删除对象?

python - 覆盖 sphinx 的 autodoc 中的函数声明

python - 用线程 boost python