Search code examples
pythongoogle-app-engineinternal-server-error

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

Solution

  • 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.