Python 使用斯芬克斯';带Django的autodoc

Python 使用斯芬克斯';带Django的autodoc,python,django,python-sphinx,Python,Django,Python Sphinx,我无法让Sphinx从apps的models.py文件为我的Django项目自动生成文档。当我运行makehtml时,我会收到警告 WARNING: toctree contains reference to nonexisting document u'modules/models' 我的目录设置是: .../www/proj/manage.py /proj/settings.py /urls.py

我无法让Sphinx从apps的
models.py
文件为我的Django项目自动生成文档。当我运行
makehtml
时,我会收到警告

WARNING: toctree contains reference to nonexisting document u'modules/models'
我的目录设置是:

.../www/proj/manage.py
             /proj/settings.py
                  /urls.py
                  ...
             /myapp1/models.py
                   /views.py
                   ...
             /docs/Makefile
                  /build/
                  /modules/models.rst
                  /source/conf.py
                         /index.rst
                         ...
index.rst的相关位为:

Documentation for qdb
=====================

Contents:

.. toctree::
   :maxdepth: 2

   modules/models



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Models
======
.. automodule:: myapp1.models
    :members:
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
from django.conf import settings
settings.configure()
模块/模型。rst
是:

Documentation for qdb
=====================

Contents:

.. toctree::
   :maxdepth: 2

   modules/models



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Models
======
.. automodule:: myapp1.models
    :members:
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
from django.conf import settings
settings.configure()
来自
conf.py
的位是:

Documentation for qdb
=====================

Contents:

.. toctree::
   :maxdepth: 2

   modules/models



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Models
======
.. automodule:: myapp1.models
    :members:
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
from django.conf import settings
settings.configure()
我也试过:

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'qdb.settings'
但这也不起作用。如何告诉Sphinx在哪里可以找到
模块/模型.rst


[我使用的是Python 2.7、Django 1.8、Sphinx 1.3.1]

这是一个老问题,但我刚刚读过它,我认为这是因为index.rst文件与modules文件夹不在同一级别,您需要指定../modules/models,而不是modules/models