jc53593
jc53593

Reputation: 3

GAE service URL handlers not found

I feel like I must be missing something obvious, but all the examples I can find seem to suggest this should be working.

My app.yaml file:

runtime: python27
api_version: 1
threadsafe: true
service: myservice

handlers:
- url: /call
  script: main.app
- url: /.*
  script: main.app

When I visit this URL, I get the output I expect:

http://myservice-dot-myappname.appspot.com/

However, this yields a 404 Not Found:

http://myservice-dot-myappname.appspot.com/call

(Note: myservice and myappname are both subbed in to hide the real names.)

What am I missing??

For completeness, I have a main.py with the following content (there is no main.app file, but Google's example that I created this from also is set up this way):

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('<?xml version="1.0" encoding="UTF-8"?>\n')
        self.response.write('<Response>\n')
        self.response.write('   <Say voice="woman" language="fr-FR">Chapeau!</Say>\n')
        self.response.write('</Response>\n')

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

Upvotes: 0

Views: 60

Answers (1)

michaelrccurtis
michaelrccurtis

Reputation: 1172

The problem is with app as defined in main.py. The request to '/call' will be routed here, but you don't have a route defined that will catch it. If you want a catch all, try:

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

Or you may want to catch and treat the call request separately, say:

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

Upvotes: 3

Related Questions