DISQUS

Benjamin Golub's Blog: Remove trailing slash on App Engine - Benjamin Golub's Blog

  • Jeremy Selier · 3 months ago
    Hello, thanks for this tip. But in order for this to work, we need to setup in the main function a line to catch every request no?

    For example, I have (r"/entry/([^/]+)", views.EntryHandler)
    If I hit something like "/entry/whatever/" I will get a 404

    So in order to this code to work, we need a ("/.*", WhateverHandler), at the end of our main to get every non-catched request, and of course, WhateverHandler will inherit from BaseHandler.
    Am I correct?
  • Benjamin Golub · 3 months ago
    If everything inherits from BaseRequestHandler and all patterns end in /?
    then you don't need that. Take a look at my blog's code for how this works:
    http://github.com/bgolub/blog/blob/master/main.py
  • Jeremy Selier · 3 months ago
    This totally makes sense, I blame myself for not thinking of it. Thank you for the link, this is a nice piece of code!