2011-10-15 5 views
6

私のアプリケーションにOAuth2.0を実装しようとしていますが、今修正できない問題があります。OAuth2.0ダンスの "memcache"サービスでapiプロキシが見つかりません

エラーは次のとおりです。

Traceback: 
File "/home/i159/Envs/photorulez/lib/python2.6/site- packages/django/core/handlers/base.py" in get_response 
111.       response = callback(request, *callback_args, **callback_kwargs) 
File "/home/i159/workspace/photorulez/photorulez/photoapp/views.py" in get_token 
63.  saved_token = gdata.gauth.AeLoad(request.GET.get('oauth_token')) 
File "/home/i159/Envs/photorulez/lib/python2.6/site-packages/gdata/gauth.py" in ae_load 
1289. token_string = gdata.alt.app_engine.get_token(key_name) 
File "/home/i159/Envs/photorulez/lib/python2.6/site-packages/gdata/alt/app_engine.py" in get_token 
51. token_string = memcache.get(unique_key) 
File "/home/i159/Envs/photorulez/lib/python2.6/site- packages/google/appengine/api/memcache/__init__.py" in get 
487.  self._make_sync_call('memcache', 'Get', request, response) 
File "/home/i159/Envs/photorulez/lib/python2.6/site-packages/google/appengine/api/apiproxy_stub_map.py" in MakeSyncCall 
94. return stubmap.MakeSyncCall(service, call, request, response) 
File "/home/i159/Envs/photorulez/lib/python2.6/site-packages/google/appengine/api/apiproxy_stub_map.py" in MakeSyncCall 
301.  assert stub, 'No api proxy found for service "%s"' % service 

Exception Type: AssertionError at /get_access_token/ 
Exception Value: No api proxy found for service "memcache" 

コードは次のとおりです。ピップ経由

CONSUMER_KEY = 'anonymous' 
CONSUMER_SECRET = 'anonymous' 
SCOPES = ['https://picasaweb.google.com/data/',] 

def oauth2_login(request): 
    client = gdata.docs.client.DocsClient(source='photorulez') 

    oauth_callback_url = 'http://%s/get_access_token' % '127.0.0.1:8000' 

    request_token = client.GetOAuthToken(
     SCOPES, 
     oauth_callback_url, 
     CONSUMER_KEY, 
     consumer_secret=CONSUMER_SECRET) 

    request.session['request_token'] = request_token 
    return HttpResponseRedirect(request_token.generate_authorization_url()) 


def get_token(request): 
    client = gdata.docs.client.DocsClient(source='photorulez') 
    saved_token = gdata.gauth.AeLoad(request.GET.get('oauth_token')) 
    uri = 'http://127.0.0.1:8000' 

    request_token = gdata.gauth.AuthorizeRequestToken(
     saved_token, 
     uri)  
    access_token = client.GetAccessToken(request_token) 

    client.auth_token = gdata.gauth.OAuthHmacToken(CONSUMER_KEY, 
     CONSUMER_SECRET, 
     access_token.token, 
     access_token.token_secret, 
     gdata.gauth.ACCESS_TOKEN) 
    return HttpResponseRedirect('/') 

私はインストールされたgoogle_appengine-1.5.1モジュールは、私のアプリは、DjangoのDEV-サーバー上で実行されています。それを修正するために私は何ができますか?私はGAEでのみ実行する必要がありますか?

答えて

5

OAth実装でGAE memcacheサービスが使用されているため、GAEを実行する必要があるようです。 DjangoサーバーがGAE呼び出しを処理することをGAE APIに伝えています。おそらく、GAEの開発サーバーを実行して、要求を処理できるようにする必要があります。

GAEサーバーを実行したくない場合は、this blog entryは、この要求を処理するのに十分なGAEを実行するコードを表示しているようです。

+0

したがって、Django memcacheフレームワークを使用する機会はありませんか? – I159

+0

gauthモジュール内ですべてが起きているようです。それは、GAE memcacheサービスを使用するためにプロキシを使用するようです。 – ubiquitousthey

関連する問題