简体   繁体   English

Google App Engine的Python代码出现服务器错误

[英]Server Error with Python code for Google App Engine

I have been trying to deploy code onto GAE but I keep getting 500 server error when trying. 我一直在尝试将代码部署到GAE上,但是尝试时不断出现500个服务器错误。

Using the Pycharm environment I do not see errors in the code. 使用Pycharm环境,我看不到代码中的错误。 Can someone help me with what is causing the issue? 有人可以帮助我解决导致问题的原因吗? I have also tried to use the Postman plugin to get responses with GET and POST but unable to do so due to 500 Internal Server Error. 我也曾尝试使用Postman插件来获取GET和POST响应,但由于500 Internal Server Error而无法实现。 Thanks for the time and help. 感谢您的时间和帮助。

The error in the AppEngine Logs. AppEngine日志中的错误。

    Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 269, in _LoadHandler
    raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'main' from '/base/data/home/apps/s~newstartapptest/1.367182586650515795/main.py'> has no attribute app

In app.yaml , assuming the code you show above is in main.py , you're probably using app.yaml ,假设上面显示的代码在main.py ,则可能是在使用

script: main.app

But the global you're using to hold the WSGIApplication is named application , not app . 但是,您用于保存WSGIApplication的全局名称为application ,而不是app Rename the variable. 重命名变量。

You either have to: 您要么必须:

from google.appengine.ext import webapp

Or, 要么,

import webapp2

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM