gpt4 book ai didi

django - Django 文档字符串和 Sphinx 的未知解释文本角色 "setting"

转载 作者:行者123 更新时间:2023-12-02 08:50:36 24 4
gpt4 key购买 nike

我正在记录 Djagno 2.2 应用程序。

Django documentation链接到设置的状态为

Add :mod:`django.contrib.auth` to your :setting:`INSTALLED_APPS`...

在我的文档中,声明是

The length is defined in the :setting:`URL_ID_LENGTH`

使用Sphinx生成文档时

make html

给出警告

:docstring of app.models.Class.function:4: WARNING: Unknown interpreted text role "setting".

我已将 sphinx.ext.intersphinx 添加到 Sphinxconf.py 中。

最佳答案

根据Django documentation ,它有自己特定的标记。

您需要从 Django 的 conf.py 添加 djangodocs进入你的:

extensions = [
"djangodocs",
'sphinx.ext.extlinks',
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]

然后放置djangodocs extension file进入您的 docs/_ext/djangodocs.py

最后import its path像这样的东西:

sys.path.append(abspath(join(dirname(__file__), "_ext")))

关于django - Django 文档字符串和 Sphinx 的未知解释文本角色 "setting",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56803854/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com