设置我的远程api

时间:2011-11-11 20:09:31

标签: python google-app-engine

My app需要备份系统和远程管理,因此我禁用了联合登录以便于remote_api访问。现在我可以登录但我无法导入我的模块:

montao$ python ./remote_api_shell.py -s montaoproject.appspot.com
Email: niklasro
Password: 
App Engine remote_api shell
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2]
The db, users, urlfetch, and memcache modules are imported.
s~montaoproject> import i18n
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named i18n
s~montaoproject> 

你能告诉我如何运行一些简单的远程api命令吗?我可以运行备份系统并通过/_ah/remote.api与python 2.7连接,所以我的设置似乎正确,我可能只需要更清楚地了解如何使用remote_api。

更新

这可行,但似乎使用django 0.96:

ubuntu@ubuntu:/media/Lexar/montao$ PYTHONPATH=./montaoproject python ./remote_api_shell.py -s montaoproject.appspot.com
App Engine remote_api shell
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2]
The db, users, urlfetch, and memcache modules are imported.
s~montaoproject> import i18n
WARNING:root:You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information see http://code.google.com/appengine/docs/python/tools/libraries.html#Django
s~montaoproject> 

1 个答案:

答案 0 :(得分:4)

使用PYTHONPATH=.添加命令(或将.替换为您的应用所在的目录)。在没有告诉Python它可以找到模块的地方,它不知道在哪里看,默认情况下当前目录不是路径的一部分。