Configuring Django options for sphinx (documentation)

I have a Django application in which I am trying to set up the documentation. The directory structure is as follows:

- doc
- project
| - manage.py

I set the paths so that Sphinx can see things, but when I try to use autodoc, some settings that I set in settings.py are not available. This is how I set up the environment, what am I doing wrong?

from django.core.management import setup_environ
from project import settings

setup_environ(settings, 'project.settings')
+5
source share
1 answer

I can only think of two reasons why a call setup_environ()in your Sphinx conf.pydoes not work:

  • He does not do his magic early enough. You import other things that already need settings before this line.

  • settings.py . , .

, setup_environ() . Django 1.6.

- os.environ conf.py script. : -)

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
+7

All Articles