简体   繁体   中英

Google app engine localhost server error python

I was just trying to run the hello world program in google app engine. But when I try to run the application on my browser I get a 500 server error. I tried re-installing both GAE app engine launcher and python 2.7.5. But no luck!

here is my hello.py

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


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

app.yaml

application: silent-blend-359
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
    script: hello.application

the log is to big so i pasted it here http://paste.ubuntu.com/6195427/

SOLVED

I was using a proxy to connect to the internet. Just disabled the proxy and voila! Problem solved!

Indendation is part of Python syntax. Indent correctly:

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')

And, replace following line in app.yaml (There's no application in hello.py , but app ):

hello.application

with:

hello.app

hello.py

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


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

app.yaml

application: silent-blend-359
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: hello.app

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