关于现有项目的Python Sphinx文档,KeyError u' language'

时间:2014-11-26 09:39:38

标签: python flask python-sphinx keyerror

我试图在我已经完成的烧瓶网络应用程序上实施Sphinx文档。 当我尝试使用以下命令运行Sphinx时:

sphinx-apidoc -F -A "MonitoringApplication" -V "0.1" -o docs App

它为我的python脚本创建了第一个文件,但随后退出时出现以下错误: 在:Sphinx\quickstart.py, line 1328, in generate conf_text = QUICKSTART_CONF % d KeyError: u'language

谷歌对这个错误并不是很好,所以我来到这里! 额外信息:

Sphinx版本1.3b1-py2.7, 操作系统:Windows 7,Sphinx在虚拟环境(venv)中运行

项目目录示例:

App/
  --MoitoringApplication.py
  --models.py
  --database.py
  --functions.py
  --etc.py
  templates/
    --index.html
    --overview.html
    --etc.html
  static/
    --jquery.js
    --etc.js
    images/
      --logo.jpg

运行Sphinx-apidoc命令,构建了以下目录:

docs/
  _build/
    ..
  _static/
    ..
  _templates/
    ..
  --MonitoringApplication.rst
  --functions.rst
  --models.rst
  --database.rst
  --etc.rst

我使用了错误的命令,或者我的目录是否排序不正确,还是我需要的不同的Sphinx版本? 谢谢你的时间。

2 个答案:

答案 0 :(得分:0)

在Sphinx配置文件中设置语言,例如:

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
language = 'de'

答案 1 :(得分:0)

发现我错过了__init__。py在我的包裹中。

还需要在sys.path.append("../App")中添加config.py

然后使用 sphinx-apidoc 生成新的.rst文件。

然后make html为我工作了。