2013-03-15 24 views
2

嗨我正在寫一些使用獅身人面像Django項目的文檔。獅身人面像autodoc不導入模塊

我的項目(Django的1.4)看起來是這樣的:

/funproject 
    /documentation 
     # this is where sphinx files live 
     /source 
      conf.py 
      ... 
    /funproject 
     __init__.py 
     settings.py 
     admin.py 
     models.py 
    /app1 
    /app2 
    fabfile.py 
    manage.py 

我在conf.py獅身人面像設置:

import sys, os 

sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) 

os.environ['DJANGO_SETTINGS_MODULE'] = 'funproject.settings' 

from funproject import settings 
from django.core.management import setup_environ 
setup_environ(settings) 
在我的獅身人面像源文件

所以我可以這樣做:

.. automodule:: app1.models 
    :members: 

它工作正常。然而,這兩個例子不工作:

1.

.. automodule:: funproject.models 
    :members: 

2.

.. automodule:: fabfile 
    :members: 

的第二部作品,如果我移動到fabfile APP1和使用app1.fabfile

我米猜測我有我的conf.py一些問題,但我已經嘗試了很多衍生物,但我不能導入我的fabfile.py,除非它是在應用程序目錄下(第儘管在/funproject之下它也不起作用)。

任何幫助,這將不勝感激。

回答

0

你可能會嘗試使用fabric fabfile目錄風格?也許這是automodule不看單個文件模塊的情況?有關這種其他風格的文檔是here