I'm trying to do a simple redirection after logging the user. I thought I could use the print "Location:..." method but that doesn't seem to do the trick.
class MainPage(webapp.RequestHandler):
def get(self):
ip = self.request.remote_addr
log = Log()
log.ip_address = ip
log.put()
print "Location:http://www.appurl.com"
Another option would be to do it directly on appengine_config.py
i.e. if you want to redirect everything to "http://www.google.com" you could add the following:
i.e. if you want to do something based on the host you could do:
RequestHandler
has aredirect()
method that you can use. It takes two parameters, the first one being the url to redirect to, and the second one a boolean value. If you pass true, it sends a 301 code to indicate a permanent redirect, if you don't pass it an explicit value, it defaults to false, and sends the client a 302 code to indicate a temporary redirect.Something like this: