2

Hi I am writing some documentation for a Django project using sphinx.

My project (Django 1.4) looks like this:

/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 

I have sphinx setup in the 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)

So in my sphinx source files I can do this:

 .. automodule:: app1.models
    :members: 

which works fine. However, these two examples do not work:

1.

 .. automodule:: funproject.models
    :members: 

2.

 .. automodule:: fabfile
    :members: 

The second works if I move the fabfile into app1 and use app1.fabfile

I'm guessing I have some issue with my conf.py but I have tried many derivations but I cannot import my fabfile.py unless it is under an app dir (though under /funproject it doesn't work either).

Any help with this would be much appreciated.

4

1 回答 1

0

您可以尝试使用fabric fabfile 目录样式吗?也许是 automodule 不查看单个文件模块的情况?这种其他风格的文档在这里

于 2013-12-28T06:41:24.037 回答