我使用sphinx在本地記錄我的金字塔項目。本地autodoc
工作正常,文檔看起來是我想要的。更改sys.path以讀取文檔
但如果我使用讀我得到每個使用車博士特徵的以下錯誤文檔:
/home/docs/checkouts/readthedocs.org/user_builds/buchungssystem/checkouts/latest/docs/source/02database/02models.rst:8: WARNING: autodoc: failed to import class u'Person' from module u'buchungssystem.models.person'; the following exception was raised: Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/buchungssystem/envs/latest/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 385, in import_object __import__(self.modname) ImportError: No module named buchungssystem.models.person
我的項目的結構是這樣的:
project
->code
->models
->scripts
->...
->__init__.py
->...
->docs
->conf.py
->documentation
->setup.py
我想我的sys.path配置不正確。嘗試了很多後,我回到了你sys.path.insert(0, os.path.abspath('.'))