I am running the following code as my GAE application.
class HomeHandler(webapp2.RequestHandler):
def get(self):
self.response.write('This is the HomeHandler.')
class ProductListHandler(webapp2.RequestHandler):
def get(self):
self.response.write('This is the ProductListHandler.')
class ProductHandler(webapp2.RequestHandler):
def get(self, product_id):
self.response.write('This is the ProductHandler. '
'The product id is %s' % product_id)
app = webapp2.WSGIApplication([
(r'/', HomeHandler),
(r'/products', ProductListHandler),
(r'/products/(\d+)', ProductHandler),
])
When I try to access, only '/' route is working (https://myapp.appspot.com) which prints 'This is the HomeHandler'. If I try to access https://myapp.appspot.com/products, I am getting
The requested URL /products was not found on this server
I am new to server side development. What am I doing wrong?
Most likely your app.yaml
is wrongly configured. Make sure you have .*
in your url
part.
handlers:
- url: .*
script: main.app