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

45👍

Long time to find the solution:

In the conf.py, add the following:

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

Leave a comment