Search code examples
pythongoogle-app-enginewebwebapp2

webapp2 route fails


I'm building my new website using app-engine with python and webapp2 I'm having hard times to define the URIs in my web application

the result I need is:

http://www.example.com/
http://www.example.com/products/
http://www.example.com/products/table

I thought it's an easy task, but apparently it is not (for me, anyway)

I'm getting 404 error when I'm trying to load something like that: http://www.example.com/products/chair/

where is my mistake?

app = webapp2.WSGIApplication([
webapp2.Route('/', MainPage),
webapp2.Route('/products/', handler=MainProductsHandler),
webapp2.Route('/products/(\w+)/', handler=ProductHandler)
],debug=True)

Solution

  • OK, I solved it. just like that:

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

    I think that I had a problem when I used the webapp2.Route method

    thanks anyway