Repository: wagtail/wagtail
File: docs/conf.py (Python)

Code before:
from datetime import datetime

import django
import sphinx_wagtail_theme
from sphinx.builders.html import StandaloneHTMLBuilder

from wagtail import VERSION, __version__

# use png images as fallback, required to build pdf
StandaloneHTMLBuilder.supported_image_types = ["image/gif", "image/png"]

# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# Relative path to the root of the documentation, used for linking to the
# Typedoc-generated sub-docs. RTD allows optional language and version.
base_path = ""
if rtd_lang := os.environ.get("READTHEDOCS_LANGUAGE", ""):
    base_path += f"/{rtd_lang}"
if rtd_version := os.environ.get("READTHEDOCS_VERSION", ""):
    base_path += f"/{rtd_version}"

html_context = {
    "base_path": base_path,
}

html_theme = "sphinx_wagtail_theme"
html_theme_path = [sphinx_wagtail_theme.get_html_theme_path()]

html_theme_options = {
    "project_name": "Wagtail Documentation",
    "github_url": "https://github.com/wagtail/wagtail/blob/main/docs/",
}

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(".."))

# Autodoc may need to import some models modules which require django settings
# be configured
os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.test.settings"
django.setup()

# Use SQLite3 database engine so it doesn't attempt to use psycopg2 on RTD
os.environ["DATABASE_ENGINE"] = "django.db.backends.sqlite3"

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

Review comment (refactor):
We can remove this if `root_doc` accomplishes the same thing


```suggestion
```

Code after:
from datetime import datetime

import django
import sphinx_wagtail_theme
from sphinx.builders.html import StandaloneHTMLBuilder

from wagtail import VERSION, __version__

# use png images as fallback, required to build pdf
StandaloneHTMLBuilder.supported_image_types = ["image/gif", "image/png"]

# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# Relative path to the root of the documentation, used for linking to the
# Typedoc-generated sub-docs. RTD allows optional language and version.
base_path = ""
if rtd_lang := os.environ.get("READTHEDOCS_LANGUAGE", ""):
    base_path += f"/{rtd_lang}"
if rtd_version := os.environ.get("READTHEDOCS_VERSION", ""):
    base_path += f"/{rtd_version}"

html_theme = "sphinx_wagtail_theme"
html_theme_path = [sphinx_wagtail_theme.get_html_theme_path()]

html_theme_options = {
    "project_name": "Wagtail Documentation",
    "github_url": "https://github.com/wagtail/wagtail/blob/main/docs/",
}

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(".."))

# Autodoc may need to import some models modules which require django settings
# be configured
os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.test.settings"
django.setup()

# Use SQLite3 database engine so it doesn't attempt to use psycopg2 on RTD
os.environ["DATABASE_ENGINE"] = "django.db.backends.sqlite3"

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.