Reputation: 31513
Following instructions on this page, Accessing the datastore remotely with remote_api:
I edited app.yaml
to include these lines:
builtins:
- remote_api: on
I opened up a Terminal:
$ cd /path/to/app
$ python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s localhost:8082 -p /_ah/remote_api
At the root of my app folder structure, I have a module named foobar.py
, as well as a package named data_models
. After gaining access to the remote_api
Python interpreter, I try the following lines:
import foobar
import data_models
But I get an error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named foobar
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named data_models
How do I access the interactive console through the Terminal? Am I missing something? The same thing happens even if I login to the cloud server:
$ python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s my-app.appspot.com -p /_ah/remote_api
Upvotes: 0
Views: 2269
Reputation: 31513
I added the following lines to my .bash_profile
so that I won't have to edit PYTHONPATH
every time I fire up the Terminal.
PYTHONPATH = "/path/to/app"
export PYTHONPATH
Upvotes: 0
Reputation: 101139
remote_api
just makes it possible to make RPC calls from a local task to a remote instance of an App Engine app. The Python console itself is still local, and everything you do executes locally. That means that any modules you try and import must exist on your local machine, somewhere your Python instance can find them - probably by adding your app's directory to PYTHONPATH
, like this:
$ PYTHONPATH=/my/app/dir python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s my-app.appspot.com -p /_ah/remote_api
Upvotes: 3
Reputation: 3866
It seems that the remote_api is in a different path than your app so it curpwd is that of the remote_api so your app's code is not available
Upvotes: -1