1

我是狮身人面像文档的新手。我按照 sphinx 文档为我的cherrypy 项目配置 sphinx。但是当我运行make html它时,它会给我带来很多错误和警告,如下所示:

Traceback (most recent call last):.root                                                                                                                                                         
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.root.urls
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.root.views
Traceback (most recent call last):.search                                                                                                                                                       
 File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in       import_object                                                                  
__import__(self.modname)                                                                                                                                                                    
ImportError: No module named myproject.apps.search.searchBll                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                              
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object                                                                  
__import__(self.modname)                                                                                                                                                                    
ImportError: No module named myproject.apps.search.searchDal                                                                                                                                          
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.search.urls
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.search.views
.
.
.
workspace/myproject/docs/api_doc/source/myproject.apps.root.rst:7: WARNING: autodoc can't   import/find module 'myproject.apps.root.urls', it reported error: "No module named myproject.apps.root.urls", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.root.rst:15: WARNING: autodoc can't import/find module 'myproject.apps.root.views', it reported error: "No module named myproject.apps.root.views", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:7: WARNING: autodoc can't import/find module 'myproject.apps.search.searchBll', it reported error: "No module named myproject.apps.search.searchBll", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:15: WARNING: autodoc can't import/find module 'myproject.apps.search.searchDal', it reported error: "No module named myproject.apps.search.searchDal", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:23: WARNING: autodoc can't import/find module 'myproject.apps.search.urls', it reported error: "No module named myproject.apps.search.urls", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:31: WARNING: autodoc can't import/find module 'myproject.apps.search.views', it reported error: "No module named myproject.apps.search.views", please check your spelling and sys.path

looking for now-outdated files... none found
pickling environment... done
checking consistency... workspace/myproject/docs/api_doc/source/modules.rst::       WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%]   modules                                                                                                                                                                
writing additional files... (0 module code pages) genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 21 warnings.

Build finished. The HTML pages are in build/html.

有希望吗?有人请帮忙..我还在我的 conf.py 中更改了以下行:

sys.path.append('workspace/myproject/src/myproject/')
4

1 回答 1

3

myproject是一个模块。因此,您必须将其父容器添加到 PYTHONPATH(而不是 myproject-folder 本身):

sys.path.append('workspace/myproject/src/')
于 2012-10-04T07:53:41.053 回答