简体   繁体   中英

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.

Using the Pycharm environment I do not see errors in the code. 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. Thanks for the time and help.

The error in the AppEngine Logs.

    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

script: main.app

But the global you're using to hold the WSGIApplication is named application , not app . Rename the variable.

You either have to:

from google.appengine.ext import webapp

Or,

import webapp2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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