2017-02-24 111 views
0

我直接跟着this tutorial獅身人面像不生成聲明模塊的文檔

我的代碼住在N:/Tools/data/generic_accessor.py

而且generic_accessor.py包含的東西,如:

def access_hfri_returns(terms=[]): 
    """ 
    This accesses HFRI returns data. 
    Returns: 

    """ 

在generic_accessor只有功能,沒有課。

我說:

sys.path.insert(0,"N:\\Tools\\data") 

N:\Tools\data\conf.py

N:\Tools\data\index.rst寫着:

.. data documentation master file, created by 
    sphinx-quickstart on Fri Feb 24 11:52:57 2017. 
    You can adapt this file completely to your liking, but it should at least 
    contain the root `toctree` directive. 

Welcome to data's documentation! 
================================ 

Contents: 

.. toctree:: 
    :maxdepth: 2 

.. automodule:: generic_accessor 

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

* :ref:`genindex` 
* :ref:`modindex` 
* :ref:`search 

我重新make html但我N:\Tools\data\_build\html\index.html看起來是這樣的: enter image description here

我沒有看到文檔generic_accessor任何地方。

感謝您的任何指導。

+0

你加' 「sphinx.ext.autodoc」'到'conf.py'了'extensions'列表? – jwodder

回答

0

嘗試下面的修改。請注意,我正在使用.txt文件。

index.txt

.. data documentation master file, created by 
    sphinx-quickstart on ... 
    You can adapt this file completely to your liking, but it should at least 
    contain the root `toctree` directive. 

Welcome to data's documentation! 
=================================== 

Contents: 

.. toctree:: 
    :maxdepth: 2 

    generic_accessor 




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

* :ref:`genindex` 
* :ref:`modindex` 
* :ref:`search` 

generic_accessor.txt

:mod:`generic_accessor` 
========================== 

.. automodule:: generic_accessor 
    :members: 
    :undoc-members: 
    :inherited-members: 
    :show-inheritance: 
+0

我還需要使用'sys.path.insert(0,「N:\\ tools」)在我的配置中明確地添加父目錄' –