Skip to content

Commit 722ded7

Browse files
committed
docs: add how-to document django settings
* Added how-to documenting_django_settings.rst. * Updated index.rst to separate out contrib section. ARCHBOM-1721
1 parent 2aae8df commit 722ded7

4 files changed

Lines changed: 75 additions & 3 deletions

File tree

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ def get_version(*file_paths):
470470
'python': ('https://docs.python.org/3.6', None),
471471
'django': ('https://docs.djangoproject.com/en/1.11/', 'https://docs.djangoproject.com/en/1.11/_objects/'),
472472
'model_utils': ('https://django-model-utils.readthedocs.io/en/latest/', None),
473+
'edx_toggles': ('https://edx.readthedocs.io/projects/edx-toggles/en/latest/', None),
473474
}
474475

475476

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
***********************************
2+
How to: Documenting Django settings
3+
***********************************
4+
5+
.. contents::
6+
:depth: 1
7+
:local:
8+
9+
Types of Django Settings
10+
========================
11+
12+
For documentation purposes, in the Open edX codebase there are two types of Django settings:
13+
14+
* Non-boolean Django settings.
15+
* Boolean Django settings, also known as feature toggles.
16+
17+
This how-to is concerned with the non-boolean Django settings. For boolean Django settings, or feature toggles, read :doc:`how-to document feature toggles <edx_toggles:how_to/documenting_new_feature_toggles>` instead.
18+
19+
The documentation of Django settings is a crucial source of information for a very wide audience, including Open edX operators, product owners and developers. The documentation will be available to developers directly in code, and extracted into a human-readable document to be used by all audiences, and especially for Open edX operators.
20+
21+
Please keep all of these audiences in mind when crafting your documentation.
22+
23+
Example Documentation
24+
=====================
25+
26+
Boilerplate template
27+
--------------------
28+
29+
Copy-paste this boilerplate template to document a Django setting::
30+
31+
# .. setting_name: SOME_SETTING_NAME
32+
# .. setting_default: Replace this with the default (non-boolean) value of the setting.
33+
# .. setting_description: Add here a detailed description of the purpose and usage of this setting.
34+
# Note that all annotations can be spread over multiple lines by prefixing every line after the first by
35+
# at least three spaces (two spaces plus the leading space).
36+
# .. setting_warning: (Optional) Add here additional instructions that users should be aware of. For instance, dependency
37+
# on additional settings or feature toggles should be referenced here. If this field is not needed, simply remove it.
38+
SOME_SETTING_NAME = ...
39+
40+
If you have a dict of settings, you can use the following example::
41+
42+
# .. setting_name: SOME_SETTING_DICT_NAME
43+
# .. setting_default: dict of settings
44+
# .. setting_description: First provide a general description about all the settings in the dict. Then include a sentence like:
45+
# See SOME_SETTING_DICT_NAME[XXX] documentation for details of each setting.
46+
SOME_SETTING_DICT_NAME = dict(
47+
48+
# .. setting_name: SOME_SETTING_DICT_NAME['SOME_SETTING_NAME']
49+
# ... # See docs above for the other setting annotations.
50+
SOME_SETTING_NAME = ...,
51+
52+
)
53+
54+
Additional details
55+
==================
56+
57+
There are a variety of tips in `certain sections of the how-to for documenting feature toggles`_, that are applicable to documenting non-boolean Django settings as well, but are not duplicated in this document. We recommend you get familiar with the applicable subsections of "Additional details" and "Documenting legacy feature toggles" from the feature toggle how-to.
58+
59+
.. _certain sections of the how-to for documenting feature toggles: https://edx.readthedocs.io/projects/edx-toggles/en/latest/how_to/documenting_new_feature_toggles.html#additional-details
60+
61+
Additional resources
62+
====================
63+
64+
The documentation format used to annotate non-boolean Django settings is also available from code-annotations repository: `setting_annotations.yaml <https://github.com/edx/code-annotations/blob/master/code_annotations/contrib/config/setting_annotations.yaml>`__.
File renamed without changes.

docs/index.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,26 @@ Contents:
1111

1212
.. toctree::
1313
:maxdepth: 2
14+
:caption: General
1415

15-
readme
16+
README <readme>
1617
getting_started
1718
writing_annotations
1819
static_search
1920
django_search
2021
configuration
21-
sphinx_extensions
2222
extensions
2323
testing
24-
modules
24+
Package Reference <modules>
2525
changelog
2626

27+
.. toctree::
28+
:maxdepth: 2
29+
:caption: Contrib Code
30+
31+
decisions/0001-config-and-tools
32+
contrib/sphinx_extensions
33+
contrib/how_to/documenting_django_settings
2734

2835
Indices and tables
2936
==================

0 commit comments

Comments
 (0)