Use GAE remote api with local (dev) installation

2019-06-26 01:57发布

Has anyone find to use the GAE remote api but instead of connecting to AppEngine to connect to localhost? For dev purposes of course

4条回答
Melony?
2楼-- · 2019-06-26 02:32

i was able to get this working by adding the following to the app.yaml file

builtins:
- remote_api: on

and then from the command line you can access the db, users, urlfetch or memcache modules

remote_api_shell.py -s localhost:8080

This will prompt you for the email and password but this is not important right now. the remote_api_shell.py is on my path from the google app engine directory

查看更多
Deceive 欺骗
3楼-- · 2019-06-26 02:37

If there are some like me who prefer to execute from a python script rather than a shell:

from google.appengine.ext.remote_api import remote_api_stub

remote_api_stub.ConfigureRemoteApiForOAuth('localhost:8081', '/_ah/remote_api', secure=False)
os.environ['SERVER_SOFTWARE'] = 'Development'
os.environ['HTTP_HOST'] = 'localhost:8080'

... do stuff ...

I run the dev server with the option "--api_port 8081" otherwise just look at the port used in the dev server logs ("Starting API server at ...").

The environ tweaks are to be able to use cloudstorage api against the dev server too.

查看更多
甜甜的少女心
4楼-- · 2019-06-26 02:41

Have you tried the development console? To access it, go to this URL: http://localhost:8080/_ah/admin.

If you really want to use the remote API, have a look at this article. I believe you can use the dev_server by passing the local host url to the interactive console script.

查看更多
对你真心纯属浪费
5楼-- · 2019-06-26 02:55
登录 后发表回答