Nucklear
Nucklear

Reputation: 478

Google App Engine Handler not displaying content

Hi I'm trying to get my Google App Engine application running on local host but I'm getting issues when I try to run it.

This is the code I'm tryng to run:

# helloworld.py    

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        #"Test" text is not displayed
        self.response.write("Test")

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

#This line prints the content
print "This works fine"

When I run the dev server on localhost I get Code 200 as response but the handler doesn't seems to be executed properly.

Any idea?

Upvotes: 1

Views: 81

Answers (2)

Nucklear
Nucklear

Reputation: 478

I solved this issue. Using webapp2 library I have to add the folowing code to the *.yaml file:

libraries:
- name: webapp2
  version: "2.5.2"

Upvotes: 1

Lipis
Lipis

Reputation: 21835

Your code looks fine, just make sure your in your app.yaml you have the handlers correct. It should look something like this:

application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: .*
  script: helloworld.app

libraries:
- name: webapp2
  version: "2.5.2"

If you haven't done it yet, you should also complete the Getting Started tutorial.

Upvotes: 1

Related Questions