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

标签 python google-app-engine internal-server-error

我一直在尝试将代码部署到 GAE 上,但尝试时总是收到 500 服务器错误。

使用 Pycharm 环境我没有看到代码中的错误。有人可以帮我解决导致问题的原因吗?我还尝试使用 Postman 插件来获取 GET 和 POST 响应,但由于 500 内部服务器错误而无法这样做。 感谢您的时间和帮助。

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

最佳答案

app.yaml 中,假设上面显示的代码位于 main.py 中,您可能正在使用

script: main.app

但是您用来保存 WSGIApplication 的全局名称为 application,而不是 app。重命名变量。

关于python - Google App Engine 的 Python 代码出现服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16403615/

相关文章:

python - 这段代码中出现 "object has no attribute"的原因是什么?

Python 将多个变量初始化为相同的初始值

python - 如何从 StackDriver Logging API 反序列化 App Engine 应用程序日志?

android - Paypal Android SDK : "Login Failed. System error. Please try again later", INTERNAL_SERVER_ERROR

php - 安装opencart时出现内部服务器错误

asp.net-core - ASP.NET Core 托管 - 500 内部服务器错误

Python:什么时候执行类->函数->括号。 & Matplotlib 图形不会显示

Python:将 3 个列表连接到 csv 文件中?

python - 从 App Engine 发送 HTTP 请求

json - 单引号替换 Google App Engine Webapp 中的双引号