2012-01-17 146 views
1

按照这份指南: http://code.google.com/appengine/articles/remote_api.htmlPython。使用remote_api错误,Google App Engine的

我编辑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

你的app.yaml实际上是什么样的? – geoffspear 2012-01-17 12:34:26

+0

其他错误信息只显示我的html代码 – Hadi 2012-01-17 14:44:16

+0

更新:app.yaml现在包含在帖子中 – Hadi 2012-01-17 14:47:26

回答

1

几点建议:

修改*处理器 from:

-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 

出于某种原因,一些应用程序ID将与齐读〜。

+0

试过两个,仍然得到相同的错误... – Hadi 2012-01-18 09:41:05

+0

@哈迪:我试图上传你的app.yaml到我的服务器,并没有这样的错误。所以我认为这个错误应该来自其他地方。你更新了你的appengine SDK吗?您是否正确部署您的应用程序? – lucemia 2012-01-18 17:49:24

+0

感谢您的耐心......我没有上传应用程序的问题......我想上传一些数据到我的数据存储(因为我似乎无法使用sqlite)使用api_remote(他们告诉我这是要走的路......) – Hadi 2012-01-18 19:19:14