1

I created a new project in Google Appengine but when I try to access it through localhost I get a HTTP 500 Error. My browser says 'localhost is currently unable to handle this request.' The following is my code for the new project:

app.yaml:

application: hello-world
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

main.py:

#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello world!')

app = webapp2.WSGIApplication([
    ('/', MainHandler)
], debug=True)

When I run the following command on command line:

python "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py" "C:\Users\Jason\Desktop\Hello World\hello-world"

I get the error

  import webapp2

ImportError: No module named webapp2

INFO     2016-06-18 15:29:37,092 module.py:788] default: "GET / HTTP/1.1" 500 -
JSGandora
  • 33
  • 4
  • did you run the dev-appserver? if yes, What port is it running on? What localhost url are you requesting? – mgilson Jun 15 '16 at 15:56
  • Yes I tried running dev-appserver but I get the following error: import webapp2 ImportError: No module named webapp2 I am using port 8080 and the url is http://localhost:8080/. – JSGandora Jun 15 '16 at 17:14
  • Two things I would suggest trying. First, try running your program through app engine, and not from the command line. Second, you might want to try installing and using Python 2.7 instead of 2.5. – coralvanda Jun 16 '16 at 07:29
  • @coralv I tried both running through app engine and the command line. I also do have Python 2.7 installed instead of 2.5. Is there someone wrong with my code that indicates otherwise? – JSGandora Jun 16 '16 at 13:15
  • What is the error log ? 500 should have error log in the console, assuming the request is served by the dev app server. – marcadian Jun 17 '16 at 06:46
  • @JSGandora, it was my mistake. I misread the part of your code that says Python 2.7. – coralvanda Jun 17 '16 at 09:03
  • @marcadian the error log is the following: import webapp2 ImportError: No module named webapp2 INFO 2016-06-18 15:29:37,092 module.py:788] default: "GET / HTTP/1.1" 500 - (I will update the original post with the error log as well) – JSGandora Jun 18 '16 at 19:30

1 Answers1

0

Update: the issue was fixed in SDK version 1.9.40.

There is a GAE issue causing exactly this behaviour introduced in SDK version 1.9.37, see "ImportError: No module named webapp2" after Linux SDK upgrade (1.9.35 -> 1.9.38).

If your SDK version is 1.9.37 or 1.9.38 downgrade to 1.9.36, which you can find here. At least until the fix gets released.

Community
  • 1
  • 1
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97