I'm trying to make a logout handler to redirect to whatever url called it.
There's a similar question Python webapp2: redirect back
but if I called self.request.url
in the LogoutHandler
it returns the url used to map to this handler not the page that redirected to that url.
Here's how the structure goes
class LogoutHandler(webapp2.RequestHandler):
#delete user cookies
url = self.request.url
# this prints (http://www.domain/logout) not (http://www.domain)
class MainHandler(webapp2.RequestHandler):
#send "/logout" as the href in an anchor tag"for logout" in a template
application = webapp2.WSGIApplication([
.....
('/', MainHandler),
('/logout', LogoutHandler),
.....
.....
], debug = True)
How can I get 'http://www.domain' or whatever redirected to the logout without adding the previous url as a querystring in the logout url?
webapp2, python 2.7 , Google app engine