遵循本指南: http://code.google.com/appengine/articles/remote_api.html
我编辑了我的app.yaml,更新了应用程序,并尝试使用api_remote进行连接。然后我收到了这个错误。为什么呢?
c:\python25\python "C:\Program Files
\Google\google_appengine\remote_api_shell.py" -s medmcqs.appspot.com
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\remote_api_shell.py", line 99,
in <module>
run_file(__file__, globals())
File "C:\Program Files\Google\google_appengine\remote_api_shell.py", line 95,
in run_file
execfile(script_path, globals_)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\remote_a
pi_shell.py", line 140, in <module>
main(sys.argv)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\remote_a
pi_shell.py", line 136, in main
appengine_rpc.HttpRpcServer)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\remote_a
pi_shell.py", line 76, in remote_api_shell
rpc_server_factory=rpc_server_factory)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\remote_api
\remote_api_stub.py", line 645, in ConfigureRemoteApi
app_id = GetRemoteAppIdFromServer(server, path, rtok)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\remote_api
\remote_api_stub.py", line 501, in GetRemoteAppIdFromServer
'Invalid response recieved from server: %s' % response)
google.appengine.ext.remote_api.remote_api_stub.ConfigurationError: Invalid resp
onse recieved from server: <!DOCTYPE html PUBLIC "-//W3C//
这就是我的app.yaml看起来......
application: medmcqs
version: 2
runtime: python
api_version: 1
inbound_services:
- mail
handlers:
- url: /static
static_dir: static
- url: /options
script: main.py
- url: /send
script: main.py
login: required
- url: /history
script: main.py
login: required
- url: /suggest
script: main.py
login: required
- url: .*
script: main.py
builtins:
- remote_api: on
更新:以下是日志详细信息:
2012-01-18 01:40:33.659 /_ah/remote_api?rtok=252529974978 200 48ms 1kb Google-remote_api/1.0 win32/6.1.7601.2 Python/2.5.4.final.0
109.224.29.101 - - [18/Jan/2012:01:40:33 -0800] "GET /_ah/remote_api?rtok=252529974978 HTTP/1.1" 200 1605 - "Google-remote_api/1.0 win32/6.1.7601.2 Python/2.5.4.final.0" "medmcqs.appspot.com" ms=49 cpu_ms=23 api_cpu_ms=0 cpm_usd=0.000855 instance=00c61b117cf891196f8b484d5951471ac52ac0
答案 0 :(得分:1)
一些建议:
修改。*处理程序 来自:
-url: .*
script: main.py
要:
-url: /.*
script: main.py
或者:也许您可以手动添加处理程序并再次尝试查看是否存在任何差异。
- url: /_ah/remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
<强> EDIT1 强>
您可能需要尝试另一种版本的远程控制台代码。它也来自谷歌应用引擎官方网站。
#remote_console.py
#!/usr/bin/python
import code
import getpass
import sys
sys.path.append(r"C:\Program Files\Google\google_appengine")
sys.path.append(r"C:\Program Files\Google\google_appengine\lib\yaml\lib")
sys.path.append(r"C:\Program Files\Google\google_appengine\lib\fancy_urllib")
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
def auth_func():
return raw_input('Username:'), getpass.getpass('Password:')
if len(sys.argv) < 2:
print "Usage: %s app_id [host]" % (sys.argv[0],)
app_id = sys.argv[1]
if len(sys.argv) > 2:
host = sys.argv[2]
else:
host = '%s.appspot.com' % app_id
remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)
code.interact('App Engine interactive console for %s' % (app_id,), None, locals())
用法:
remote_console.py YOUR_APP_ID YOUR_APP_ID.appspot.com
或
remote_console.py s~YOUR_APP_ID YOUR_APP_ID.appspot.com
出于某种原因,某些app id将以s~开头。