mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
doc/dev: Allow all modules to be imported by Sphinx
Setup Django in Sphinx conf.py so that any Django models can be imported. Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
837e8fc6e1
commit
94df52ba73
@ -16,8 +16,24 @@ list see the documentation: http://www.sphinx-doc.org/en/master/config
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
import django.conf
|
||||
|
||||
sys.path.insert(0, os.path.abspath('../../'))
|
||||
|
||||
# -- Django setup ------------------------------------------------------------
|
||||
|
||||
# Ensure that Django models can be imported by Sphinx
|
||||
import plinth.settings # noqa pylint: disable=E402 isort:skip
|
||||
|
||||
kwargs = {}
|
||||
for setting in dir(plinth.settings):
|
||||
if setting.isupper():
|
||||
kwargs[setting] = getattr(plinth.settings, setting)
|
||||
|
||||
django.conf.settings.configure(**kwargs)
|
||||
django.setup(set_prefix=True)
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user