From 1998ba8d8c326800036e2075137a25af1c7fc3b7 Mon Sep 17 00:00:00 2001 From: Viktor Nagy Date: Thu, 22 May 2014 09:36:11 +0200 Subject: [PATCH 1/2] Added recipe to work with Sphinx --- docs/cookbook.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/cookbook.rst b/docs/cookbook.rst index 4575b8d..bc407db 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -196,3 +196,18 @@ As you can see django-configurations provides a helper module ``configurations.fastcgi`` that handles the setup of your configurations. .. _runfcgi: https://docs.djangoproject.com/en/1.5/howto/deployment/fastcgi/ + + +Sphinx +------ + +In case you would like to user the amazing `autodoc` feature of `http://sphinx-doc.org/`_, +you can initialize you django project the following way in your `conf.py`:: + + ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')) + sys.path.append(ROOT) + os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' + os.environ['DJANGO_CONFIGURATION'] = 'Dev' + + from configurations.importer import install + install() From 738b79bc70a95f0ad60374b2a25378295f80e15f Mon Sep 17 00:00:00 2001 From: Viktor Nagy Date: Tue, 12 Aug 2014 23:10:05 +0200 Subject: [PATCH 2/2] more generic path given --- docs/cookbook.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cookbook.rst b/docs/cookbook.rst index bc407db..82d109e 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -204,7 +204,7 @@ Sphinx In case you would like to user the amazing `autodoc` feature of `http://sphinx-doc.org/`_, you can initialize you django project the following way in your `conf.py`:: - ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')) + ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '/path/to/project/root')) sys.path.append(ROOT) os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' os.environ['DJANGO_CONFIGURATION'] = 'Dev'