2
0

conf.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. # Django documentation build configuration file, created by
  2. # sphinx-quickstart on Thu Mar 27 09:06:53 2008.
  3. #
  4. # This file is execfile()d with the current directory set to its containing dir.
  5. #
  6. # The contents of this file are pickled, so don't put values in the namespace
  7. # that aren't picklable (module imports are okay, they're removed automatically).
  8. #
  9. # All configuration values have a default; values that are commented out
  10. # serve to show the default.
  11. import sys
  12. from os.path import abspath, dirname, join
  13. from sphinx import version_info as sphinx_version
  14. # Workaround for sphinx-build recursion limit overflow:
  15. # pickle.dump(doctree, f, pickle.HIGHEST_PROTOCOL)
  16. # RuntimeError: maximum recursion depth exceeded while pickling an object
  17. #
  18. # Python's default allowed recursion depth is 1000 but this isn't enough for
  19. # building docs/ref/settings.txt sometimes.
  20. # https://groups.google.com/g/sphinx-dev/c/MtRf64eGtv4/discussion
  21. sys.setrecursionlimit(2000)
  22. # Make sure we get the version of this copy of Django
  23. sys.path.insert(1, dirname(dirname(abspath(__file__))))
  24. # If extensions (or modules to document with autodoc) are in another directory,
  25. # add these directories to sys.path here. If the directory is relative to the
  26. # documentation root, use os.path.abspath to make it absolute, like shown here.
  27. sys.path.append(abspath(join(dirname(__file__), "_ext")))
  28. # -- General configuration -----------------------------------------------------
  29. # If your documentation needs a minimal Sphinx version, state it here.
  30. needs_sphinx = "4.5.0"
  31. # Add any Sphinx extension module names here, as strings. They can be extensions
  32. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
  33. extensions = [
  34. "djangodocs",
  35. "sphinx.ext.extlinks",
  36. "sphinx.ext.intersphinx",
  37. "sphinx.ext.viewcode",
  38. "sphinx.ext.autosectionlabel",
  39. ]
  40. # AutosectionLabel settings.
  41. # Uses a <page>:<label> schema which doesn't work for duplicate sub-section
  42. # labels, so set max depth.
  43. autosectionlabel_prefix_document = True
  44. autosectionlabel_maxdepth = 2
  45. # Linkcheck settings.
  46. linkcheck_ignore = [
  47. # Special-use addresses and domain names. (RFC 6761/6890)
  48. r"^https?://(?:127\.0\.0\.1|\[::1\])(?::\d+)?/",
  49. r"^https?://(?:[^/.]+\.)*example\.(?:com|net|org)(?::\d+)?/",
  50. r"^https?://(?:[^/.]+\.)*(?:example|invalid|localhost|test)(?::\d+)?/",
  51. # Pages that are inaccessible because they require authentication.
  52. r"^https://github\.com/[^/]+/[^/]+/fork",
  53. r"^https://code\.djangoproject\.com/github/login",
  54. r"^https://code\.djangoproject\.com/newticket",
  55. r"^https://(?:code|www)\.djangoproject\.com/admin/",
  56. r"^https://www\.djangoproject\.com/community/add/blogs/",
  57. r"^https://www\.google\.com/webmasters/tools/ping",
  58. r"^https://search\.google\.com/search-console/welcome",
  59. # Fragments used to dynamically switch content or populate fields.
  60. r"^https://web\.libera\.chat/#",
  61. r"^https://github\.com/[^#]+#L\d+-L\d+$",
  62. r"^https://help\.apple\.com/itc/podcasts_connect/#/itc",
  63. # Anchors on certain pages with missing a[name] attributes.
  64. r"^https://tools\.ietf\.org/html/rfc1123\.html#section-",
  65. ]
  66. # Spelling check needs an additional module that is not installed by default.
  67. # Add it only if spelling check is requested so docs can be generated without it.
  68. if "spelling" in sys.argv:
  69. extensions.append("sphinxcontrib.spelling")
  70. # Spelling language.
  71. spelling_lang = "en_US"
  72. # Location of word list.
  73. spelling_word_list_filename = "spelling_wordlist"
  74. spelling_warning = True
  75. # Add any paths that contain templates here, relative to this directory.
  76. # templates_path = []
  77. # The suffix of source filenames.
  78. source_suffix = ".txt"
  79. # The encoding of source files.
  80. # source_encoding = 'utf-8-sig'
  81. # The root toctree document.
  82. root_doc = "contents"
  83. # Disable auto-created table of contents entries for all domain objects (e.g.
  84. # functions, classes, attributes, etc.) in Sphinx 5.2+.
  85. toc_object_entries = False
  86. # General substitutions.
  87. project = "Django"
  88. copyright = "Django Software Foundation and contributors"
  89. # The version info for the project you're documenting, acts as replacement for
  90. # |version| and |release|, also used in various other places throughout the
  91. # built documents.
  92. #
  93. # The short X.Y version.
  94. version = "5.0"
  95. # The full version, including alpha/beta/rc tags.
  96. try:
  97. from django import VERSION, get_version
  98. except ImportError:
  99. release = version
  100. else:
  101. def django_release():
  102. pep440ver = get_version()
  103. if VERSION[3:5] == ("alpha", 0) and "dev" not in pep440ver:
  104. return pep440ver + ".dev"
  105. return pep440ver
  106. release = django_release()
  107. # The "development version" of Django
  108. django_next_version = "5.1"
  109. extlinks = {
  110. "bpo": ("https://bugs.python.org/issue?@action=redirect&bpo=%s", "bpo-%s"),
  111. "commit": ("https://github.com/django/django/commit/%s", "%s"),
  112. "pypi": ("https://pypi.org/project/%s/", "%s"),
  113. # A file or directory. GitHub redirects from blob to tree if needed.
  114. "source": ("https://github.com/django/django/blob/main/%s", "%s"),
  115. "ticket": ("https://code.djangoproject.com/ticket/%s", "#%s"),
  116. }
  117. if sphinx_version < (8, 1):
  118. extlinks["cve"] = ("https://www.cve.org/CVERecord?id=CVE-%s", "CVE-%s")
  119. # The language for content autogenerated by Sphinx. Refer to documentation
  120. # for a list of supported languages.
  121. # language = None
  122. # Location for .po/.mo translation files used when language is set
  123. locale_dirs = ["locale/"]
  124. # There are two options for replacing |today|: either, you set today to some
  125. # non-false value, then it is used:
  126. # today = ''
  127. # Else, today_fmt is used as the format for a strftime call.
  128. today_fmt = "%B %d, %Y"
  129. # List of patterns, relative to source directory, that match files and
  130. # directories to ignore when looking for source files.
  131. exclude_patterns = ["_build", "_theme", "requirements.txt"]
  132. # The reST default role (used for this markup: `text`) to use for all documents.
  133. default_role = "default-role-error"
  134. # If true, '()' will be appended to :func: etc. cross-reference text.
  135. add_function_parentheses = True
  136. # If true, the current module name will be prepended to all description
  137. # unit titles (such as .. function::).
  138. add_module_names = False
  139. # If true, sectionauthor and moduleauthor directives will be shown in the
  140. # output. They are ignored by default.
  141. show_authors = False
  142. # The name of the Pygments (syntax highlighting) style to use.
  143. pygments_style = "trac"
  144. # Links to Python's docs should reference the most recent version of the 3.x
  145. # branch, which is located at this URL.
  146. intersphinx_mapping = {
  147. "python": ("https://docs.python.org/3/", None),
  148. "sphinx": ("https://www.sphinx-doc.org/en/master/", None),
  149. "psycopg": ("https://www.psycopg.org/psycopg3/docs/", None),
  150. }
  151. # Python's docs don't change every week.
  152. intersphinx_cache_limit = 90 # days
  153. # The 'versionadded' and 'versionchanged' directives are overridden.
  154. suppress_warnings = ["app.add_directive"]
  155. # -- Options for HTML output ---------------------------------------------------
  156. # The theme to use for HTML and HTML Help pages. See the documentation for
  157. # a list of builtin themes.
  158. html_theme = "djangodocs"
  159. # Theme options are theme-specific and customize the look and feel of a theme
  160. # further. For a list of options available for each theme, see the
  161. # documentation.
  162. # html_theme_options = {}
  163. # Add any paths that contain custom themes here, relative to this directory.
  164. html_theme_path = ["_theme"]
  165. # The name for this set of Sphinx documents. If None, it defaults to
  166. # "<project> v<release> documentation".
  167. # html_title = None
  168. # A shorter title for the navigation bar. Default is the same as html_title.
  169. # html_short_title = None
  170. # The name of an image file (relative to this directory) to place at the top
  171. # of the sidebar.
  172. # html_logo = None
  173. # The name of an image file (within the static path) to use as favicon of the
  174. # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
  175. # pixels large.
  176. # html_favicon = None
  177. # Add any paths that contain custom static files (such as style sheets) here,
  178. # relative to this directory. They are copied after the builtin static files,
  179. # so a file named "default.css" will overwrite the builtin "default.css".
  180. # html_static_path = ["_static"]
  181. # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  182. # using the given strftime format.
  183. html_last_updated_fmt = "%b %d, %Y"
  184. # Content template for the index page.
  185. # html_index = ''
  186. # Custom sidebar templates, maps document names to template names.
  187. # html_sidebars = {}
  188. # Additional templates that should be rendered to pages, maps page names to
  189. # template names.
  190. html_additional_pages = {}
  191. # If false, no module index is generated.
  192. # html_domain_indices = True
  193. # If false, no index is generated.
  194. # html_use_index = True
  195. # If true, the index is split into individual pages for each letter.
  196. # html_split_index = False
  197. # If true, links to the reST sources are added to the pages.
  198. # html_show_sourcelink = True
  199. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
  200. # html_show_sphinx = True
  201. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
  202. # html_show_copyright = True
  203. # If true, an OpenSearch description file will be output, and all pages will
  204. # contain a <link> tag referring to it. The value of this option must be the
  205. # base URL from which the finished HTML is served.
  206. # html_use_opensearch = ''
  207. # This is the file name suffix for HTML files (e.g. ".xhtml").
  208. # html_file_suffix = None
  209. # Output file base name for HTML help builder.
  210. htmlhelp_basename = "Djangodoc"
  211. modindex_common_prefix = ["django."]
  212. # Appended to every page
  213. rst_epilog = """
  214. .. |django-users| replace:: :ref:`django-users <django-users-mailing-list>`
  215. .. |django-developers| replace:: :ref:`django-developers <django-developers-mailing-list>`
  216. .. |django-announce| replace:: :ref:`django-announce <django-announce-mailing-list>`
  217. .. |django-updates| replace:: :ref:`django-updates <django-updates-mailing-list>`
  218. """ # NOQA
  219. # -- Options for LaTeX output --------------------------------------------------
  220. # Use XeLaTeX for Unicode support.
  221. latex_engine = "xelatex"
  222. latex_use_xindy = False
  223. # Set font for CJK and fallbacks for unicode characters.
  224. latex_elements = {
  225. "fontpkg": r"""
  226. \setmainfont{Symbola}
  227. """,
  228. "preamble": r"""
  229. \usepackage{newunicodechar}
  230. \usepackage[UTF8]{ctex}
  231. \newunicodechar{π}{\ensuremath{\pi}}
  232. \newunicodechar{≤}{\ensuremath{\le}}
  233. \newunicodechar{≥}{\ensuremath{\ge}}
  234. \newunicodechar{♥}{\ensuremath{\heartsuit}}
  235. \newunicodechar{…}{\ensuremath{\ldots}}
  236. """,
  237. }
  238. # Grouping the document tree into LaTeX files. List of tuples
  239. # (source start file, target name, title, author, document class [howto/manual]).
  240. # latex_documents = []
  241. latex_documents = [
  242. (
  243. "contents",
  244. "django.tex",
  245. "Django Documentation",
  246. "Django Software Foundation",
  247. "manual",
  248. ),
  249. ]
  250. # The name of an image file (relative to this directory) to place at the top of
  251. # the title page.
  252. # latex_logo = None
  253. # For "manual" documents, if this is true, then toplevel headings are parts,
  254. # not chapters.
  255. # latex_use_parts = False
  256. # If true, show page references after internal links.
  257. # latex_show_pagerefs = False
  258. # If true, show URL addresses after external links.
  259. # latex_show_urls = False
  260. # Documents to append as an appendix to all manuals.
  261. # latex_appendices = []
  262. # If false, no module index is generated.
  263. # latex_domain_indices = True
  264. # -- Options for manual page output --------------------------------------------
  265. # One entry per manual page. List of tuples
  266. # (source start file, name, description, authors, manual section).
  267. man_pages = [
  268. (
  269. "ref/django-admin",
  270. "django-admin",
  271. "Utility script for the Django web framework",
  272. ["Django Software Foundation"],
  273. 1,
  274. )
  275. ]
  276. # -- Options for Texinfo output ------------------------------------------------
  277. # List of tuples (startdocname, targetname, title, author, dir_entry,
  278. # description, category, toctree_only)
  279. texinfo_documents = [
  280. (
  281. root_doc,
  282. "django",
  283. "",
  284. "",
  285. "Django",
  286. "Documentation of the Django framework",
  287. "Web development",
  288. False,
  289. )
  290. ]
  291. # -- Options for Epub output ---------------------------------------------------
  292. # Bibliographic Dublin Core info.
  293. epub_title = project
  294. epub_author = "Django Software Foundation"
  295. epub_publisher = "Django Software Foundation"
  296. epub_copyright = copyright
  297. # The basename for the epub file. It defaults to the project name.
  298. # epub_basename = 'Django'
  299. # The HTML theme for the epub output. Since the default themes are not optimized
  300. # for small screen space, using the same theme for HTML and epub output is
  301. # usually not wise. This defaults to 'epub', a theme designed to save visual
  302. # space.
  303. epub_theme = "djangodocs-epub"
  304. # The language of the text. It defaults to the language option
  305. # or en if the language is not set.
  306. # epub_language = ''
  307. # The scheme of the identifier. Typical schemes are ISBN or URL.
  308. # epub_scheme = ''
  309. # The unique identifier of the text. This can be an ISBN number
  310. # or the project homepage.
  311. # epub_identifier = ''
  312. # A unique identification for the text.
  313. # epub_uid = ''
  314. # A tuple containing the cover image and cover page html template filenames.
  315. epub_cover = ("", "epub-cover.html")
  316. # A sequence of (type, uri, title) tuples for the guide element of content.opf.
  317. # epub_guide = ()
  318. # HTML files that should be inserted before the pages created by sphinx.
  319. # The format is a list of tuples containing the path and title.
  320. # epub_pre_files = []
  321. # HTML files that should be inserted after the pages created by sphinx.
  322. # The format is a list of tuples containing the path and title.
  323. # epub_post_files = []
  324. # A list of files that should not be packed into the epub file.
  325. # epub_exclude_files = []
  326. # The depth of the table of contents in toc.ncx.
  327. # epub_tocdepth = 3
  328. # Allow duplicate toc entries.
  329. # epub_tocdup = True
  330. # Choose between 'default' and 'includehidden'.
  331. # epub_tocscope = 'default'
  332. # Fix unsupported image types using the PIL.
  333. # epub_fix_images = False
  334. # Scale large images.
  335. # epub_max_image_width = 0
  336. # How to display URL addresses: 'footnote', 'no', or 'inline'.
  337. # epub_show_urls = 'inline'
  338. # If false, no index is generated.
  339. # epub_use_index = True