繁体   English   中英

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

[英]Python Sphinx documentation over existing project, KeyError u'language'

我正在尝试在已经完成的Flask Web应用程序上实现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,在虚拟环境(venv)中运行的Sphinx

项目目录示例:

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版本? 谢谢你的时间。

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

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

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

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

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

然后做了make html对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM