简体   繁体   English

应用程序可在本地主机上运行,​​但不能在appspot上运行

[英]App works on Local host but not on appspot

I'm working on having a user authenticate on my webpage using Foursquare, once they are redirected back to my webpage the information recieved back is parsed out of the URL. 我正在努力使用户使用Foursquare在我的网页上进行身份验证,一旦他们被重定向回我的网页,收到的信息就会从URL中解析出来。 This works perfect on localhost but when I deploy it I get the following error 这在localhost上完美运行,但是在部署它时出现以下错误

    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 UPDATE

The line in my code that seems to cause it is when I try to doRender(self, '500.html') This is the doRender method 我的代码中似乎导致该行的是我尝试执行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))

and the template is as follows 模板如下

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

Do you have an '/_ah/login_required' handler setup in your app.yaml file? 您的app.yaml文件中是否有“ / _ah / login_required”处理程序设置?

I'm assuming you've turned on Federated Login to allow Foursquare credentials. 我假设您已启用联合登录以允许Foursquare凭据。 If so you need to define your own login handler in order for it to work on appspot (localhost uses different login handling). 如果是这样,则需要定义自己的登录处理程序以使其在appspot上工作(localhost使用不同的登录处理)。

ex: 例如:

handlers:
- url: /_ah/login_required
  script: do_openid_login.py
TemplateSyntaxError: Unclosed tags: endblock, endblock bodycontent

tells you where at least one issue is. 告诉您至少一个问题在哪里。 Close the endblock : 关闭endblock

{% endblock %}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将应用部署到用户的 apppot - Deploying an app to users' appspot django api部署到Google App Engine错误:2005,“未知的MySQL服务器主机https://mythic-plexus-194517.appspot.com/products/ - django api deployed to google app engine error: 2005, "Unknown MySQL server host https://mythic-plexus-194517.appspot.com/products/ Cron在本地主机上工作,但在部署Appengine时不工作 - Cron works on local host but not when deployed Appengine Praw bot 在本地主机上运行良好,但在 heroku 上运行不佳 - Praw bot works well on local host but not on heroku 照片库适用于gae appspot但不适用于127.0.0.1 - photo gallery works on gae appspot but not on 127.0.0.1 在appspot上使用旧版的Google App Engine - Use older version of google app engine on appspot Python 应用程序可在本地主机上运行,​​但不能在 Heroku 上运行 - Python App working on local host, but not on Heroku Google App Engine本地主机问题 - Google App Engine Local Host Issue PostgreSQL登录可在本地主机上运行,​​但不能在xxxx.compute-1.amazonaws.com上运行 - PostgreSQL login works on local host but not xxxx.compute-1.amazonaws.com 我的默认应用程序是否必须部署到appspot.com? - Does my default app have to be deployed to appspot.com?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM