2011-04-16 114 views
2

我正在努力使用Foursquare在我的網頁上進行用戶身份驗證,一旦它們重定向回到我的網頁,接收到的信息將從URL中解析出來。這完美的作品在本地主機上,但是當我部署它,我收到以下錯誤應用程序適用於本地主機,但不適用於appspot

Traceback (most recent call last): 
    File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 634, in __call__ 
    handler.get(*groups) 
    File "/base/data/home/apps/hoosheer/4.349803081119561985/hoosheer_main.py", line 34, in get 
    foursquareMethods.foursquareDetails(self) 
    File "/base/data/home/apps/hoosheer/4.349803081119561985/foursquareMethods.py", line 40, in foursquareDetails 
    doRender(self, '500.html') 
    File "/base/data/home/apps/hoosheer/4.349803081119561985/foursquareMethods.py", line 67, in doRender 
    handler.response.out.write(template.render(path, template_values)) 
    File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/template.py", line 72, in render 
    t = load(template_path, debug) 
    File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/template.py", line 100, in load 
    template = django.template.loader.get_template(file_name) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader.py", line 80, in get_template 
    template = get_template_from_string(source, origin, template_name) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader.py", line 88, in get_template_from_string 
    return Template(source, origin, name) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py", line 158, in __init__ 
    self.nodelist = compile_string(template_string, origin) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py", line 174, in compile_string 
    return parser.parse() 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py", line 273, in parse 
    compiled_result = compile_func(self, token) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader_tags.py", line 154, in do_extends 
    nodelist = parser.parse() 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py", line 273, in parse 
    compiled_result = compile_func(self, token) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader_tags.py", line 132, in do_block 
    nodelist = parser.parse(('endblock', 'endblock %s' % block_name)) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py", line 280, in parse 
    self.unclosed_block_tag(parse_until) 
    File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py", line 318, in unclosed_block_tag 
    raise self.error(None, "Unclosed tags: %s " % ', '.join(parse_until)) 
TemplateSyntaxError: Unclosed tags: endblock, endblock bodycontent 

UPDATE

這似乎導致它,當我嘗試doRender(self, '500.html') 這是doRender在我的代碼行方法

def doRender(handler, tname, values = { }):  
    template_values = dict(values) 
    handler.session = Session() 
    if 'access_token' in handler.session: 
     template_values['access_token'] = handler.session['access_token'] 
    path = os.path.join(os.path.dirname(__file__), tname) 
    handler.response.out.write(template.render(path, template_values)) 

和模板是如下

{% extends "index.html" %} 
{% block bodycontent %} 
Server Error 
     <p> 
     There has been an error 
     </p> 
{% endblock %} 
+0

您是否重定向回appspot而不是本地主機? – hyperslug 2011-04-16 17:40:53

+0

@hyperslug是的,我改變它,以便它重定向到appspot – qwop 2011-04-16 22:26:33

+1

包括實際的堆棧跟蹤 - 而不是引發異常的框架代碼行 - 以及有問題的源代碼和模板。 – 2011-04-18 03:05:08

回答

1

你的app.yaml文件中有'/ _ah/login_required'處理程序設置嗎?

我假設您已啓用聯合登錄以允許Foursquare憑據。如果是這樣,你需要定義你自己的登錄處理程序,以便它在appspot上工作(本地主機使用不同的登錄處理)。

例如:

handlers: 
- url: /_ah/login_required 
    script: do_openid_login.py 
+0

我沒有聯合登錄,我甚至不知道登錄處理在appspot上有所不同,您能否將我認爲有用的任何文檔鏈接到我?目前我正在閱讀http://sites.google.com/site/oauthgoog/UXFedLogin/summary和http://code.google.com/googleapps/domain/sso/openid_reference_implementation.html – qwop 2011-04-17 10:53:15

+0

@qwop查看身份驗證「用戶概述」文章的部分內容([link](http://code.google.com/appengine/docs/python/users/overview.html))。還有一篇關於在GAE中使用聯合登錄的更深入的文章:([link](http://code.google.com/appengine/articles/openid.html)) – 2011-04-18 00:50:54

0
TemplateSyntaxError: Unclosed tags: endblock, endblock bodycontent 

告訴你,其中至少有一個問題是。關閉endblock

{% endblock %} 
相關問題