Sphinx-apidoc on django build html failure on `django.core.exceptions.AppRegistryNotReady` Sphinx-apidoc on django build html failure on `django.core.exceptions.AppRegistryNotReady` python python

Sphinx-apidoc on django build html failure on `django.core.exceptions.AppRegistryNotReady`


Long time to find the solution:

In the conf.py, add the following:

import djangosys.path.insert(0, os.path.abspath('..'))os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'django.setup()