Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26671

Setting up my remote api

My app needs a backup system and remote administration so I disabled the federated login for easier remote_api access. Now I can log in but I can't import my module:

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> 

Could you tell me how to run some simple remote api commands? I could run the backup system and connect via /_ah/remote.api with python 2.7 so my setup seems correct and I might just need clearer understanding how to use the remote_api.

Update

This works but it seems to use the 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> 

Upvotes: 2

Views: 1303

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

Prefix your command with PYTHONPATH=. (or replace . with the directory your app is in). Without telling Python where it can find modules, it doesn't know where to look, and the current directory isn't part of the path by default.

Upvotes: 4

Related Questions