HomeSoftware Heritage

sphin/conf.py: Improve django settings handling

Description

sphin/conf.py: Improve django settings handling

Software Heritage uses Django in several packages: swh-auth, swh-deposit
and swh-web.

When building global or local package documentation, the environment
variable DJANGO_SETTINGS_MODULE must be set to the adequate settings
module in order to avoid errors with sphinx autodoc processing.

Previous approach was merging swh-deposit and swh-web django settings
but it did not prevent all autodoc errors due to some missing or
unexpected django setting value.

New approach force reset Django settings according to the next rst
document to read by sphinx. This ensures adequate django settings
will be set for each swh packages before processing apidoc generated
rst files.

It also enables to not depend on swh-deposit and swh-web for building
a local package documentation.

Related to T3258

Details

Provenance
anlambertAuthored on Apr 19 2021, 5:38 PM
anlambertPushed on Apr 21 2021, 12:19 PM
Differential Revision
D5567: sphin/conf.py: Improve django settings handling
Parents
rDDOC51cb3ebfaca2: sphinx/conf.py: Merge swh-web sphinx config into root conf.py file
Branches
Unknown
Tags
Unknown
Tasks
T3258: Build documentation on every diff