anik_das
anik_das

Reputation: 31

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!

Upvotes: 1

Views: 1147

Answers (1)

falsetru
falsetru

Reputation: 369394

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

Upvotes: 2

Related Questions