在Google App Engine项目上构建Sphinx Autodoc

时间:2011-09-27 14:47:30

标签: python google-app-engine python-sphinx

我正在尝试使用Sphinx记录Google App Engine项目。我正在尝试为我的许多模块/类/函数使用autodoc功能。

我的Sphinx reST标记:

.. automodule:: urls
   :members: Urls

当我运行make html时,我收到错误:

WARNING: autodoc can't import/find module 'urls', it reported error: "No module named appengine.api", please check your spelling and sys.path

文件urls导入webapp2,我相信它会反过来尝试导入appengine.api。我认为不可能将appengine.api提供给我的sys.path。有一些解决方法吗?

PS。我没跟狮身人面像结婚。我愿意接受epydoc或其他选择。

1 个答案:

答案 0 :(得分:3)

您可以下载AppEngine SDK,然后在致电make html之前设置您的PYTHONPATH。

例如,我下载了SDK并且可以执行此操作:

$ ls /home/jterrace/Downloads/google_appengine/google/
appengine  __init__.py  net  pyglib  storage
$ PYTHONPATH="/home/jterrace/Downloads/google_appengine/google" python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import appengine
>>> import appengine.api
>>> 

所以,你会做这样的事情:

PYTHONPATH="/home/jterrace/Downloads/google_appengine/google" make html
相关问题