Anuj TBE
Anuj TBE

Reputation: 9790

Unknown interpreted text role "setting" with Django docstring and Sphinx

I'm documenting a Djagno 2.2 application.

The Django documentation states linking to the settings as

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

In my documentation, The statement is

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

When generating the documentation using Sphinx

make html

Gives WARNING

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

I have sphinx.ext.intersphinx added to the conf.py of Sphinx.

Upvotes: 4

Views: 539

Answers (1)

Steve Piercy
Steve Piercy

Reputation: 15055

According to the Django documentation, it has its own specific markup.

You will need to add djangodocs from Django's conf.py into yours:

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

Then place the djangodocs extension file into your docs/_ext/djangodocs.py.

And finally import its path with something like this:

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

Upvotes: 3

Related Questions