From 9a178f0911d0e771562cba8733185a45f507edb0 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Mon, 30 Jun 2014 11:37:55 +0100 Subject: [PATCH] Enabled autodoc in sphinx configuration --- docs/conf.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 11517ada25..0337c1e6b6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ import sys import os + # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org on_rtd = os.environ.get('READTHEDOCS', None) == 'True' @@ -26,7 +27,16 @@ if not on_rtd: # only import and set the theme if we're building docs locally # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) + +# Autodoc may need to import some models modules which require django settings +# be configured +from django.conf import settings + +if not settings.configured: + from wagtail.tests.settings import SETTINGS + settings.configure(**SETTINGS) + # -- General configuration ------------------------------------------------ @@ -36,7 +46,9 @@ if not on_rtd: # only import and set the theme if we're building docs locally # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = [] +extensions = [ + 'sphinx.ext.autodoc', +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates']