doc/dev: Fix Django related errors with auto-documentation

Closes: #2405.

- When Django module is mocked, there are some cases where modules using django
can't be imported due to errors.

- To fix that, don't mock the django module and require django and related
Debian packages to be installed on the system generate developer documentation.

- Initialize django in Sphinx configuration to allow django modules to be
imported without errors.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-08-22 10:45:47 -07:00 committed by James Valleroy
parent 3b5abf1ae9
commit 70742bfd91
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,11 @@ Install the following Debian packages:
* python3-sphinx
* python3-sphinx-autobuild
* python3-django
* python3-django-axes
* python3-django-captcha
* python3-django-ipware
* python3-django-stronghold
If your preferred text editor doesn't have support for the reStructuredText
format, you can install a simple desktop application called ReText. It has live

View File

@ -16,7 +16,11 @@ list see the documentation: http://www.sphinx-doc.org/en/master/config
import os
import sys
import django
sys.path.insert(0, os.path.abspath('../../'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'plinth.settings'
django.setup()
# -- Project information -----------------------------------------------------
@ -203,7 +207,6 @@ autodoc_mock_imports = [
'cherrypy',
'configobj',
'dbus',
'django',
'gi',
'markupsafe',
'OpenSSL',