Skip to content

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.

Depends on !286 (closed)

Related to T3258


Migrated from D5567 (view on Phabricator)

Merge request reports