Google App Engine(python) - 通过python脚本连接到本地数据存储区

时间:2015-02-07 08:47:13

标签: python google-app-engine

我已经能够从本地脚本直接连接到服务器上的Google App Engine(GAE)ndb商店,如article所述。

但是我试图做同样的事情来访问我的本地开发服务器但是我无法做到。我的dev API服务器在http://localhost:42020运行,但是当我尝试使用以下命令进行连接时:

$ remote_api_shell.py -s http://localhost:42020

我收到以下错误:

Traceback (most recent call last):
  File "/home/myuser/google_appengine/remote_api_shell.py", line 127, in <module>
    run_file(__file__, globals())
  File "/home/myuser/google_appengine/remote_api_shell.py", line 123, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/home/myuser/google_appengine/google/appengine/tools/remote_api_shell.py", line 150, in <module>
    main(sys.argv)              
  File "/home/myuser/google_appengine/google/appengine/tools/remote_api_shell.py", line 146, in main
    appengine_rpc.HttpRpcServer)
  File "/home/myuser/google_appengine/google/appengine/tools/remote_api_shell.py", line 74, in remote_api_shell
    rpc_server_factory=rpc_server_factory)
  File "/home/myuser/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 874, in ConfigureRemoteApi
    app_id = GetRemoteAppIdFromServer(server, path, rtok)
  File "/home/myuser/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 569, in GetRemoteAppIdFromServer
    response = server.Send(path, payload=None, **urlargs)
  File "/home/myuser/google_appengine/google/appengine/tools/appengine_rpc.py", line 424, in Send
    f = self.opener.open(req)   
  File "/usr/lib/python2.7/urllib2.py", line 401, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 419, in _open
    '_open', req)               
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)        
  File "/usr/lib/python2.7/urllib2.py", line 1211, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1181, in do_open
    raise URLError(err)         
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>

是否无法在本地连接?

1 个答案:

答案 0 :(得分:1)

看起来我做错了。 This answer解决了我的问题。

简而言之,我必须连接到常规Web服务器才能在没有前导http的情况下工作。这要求我的电子邮件和密码,一旦我输入,它就可以了!

$ remote_api_shell.py -s localhost:8080