GAE redirection with a delay

后端 未结 2 1910
走了就别回头了
走了就别回头了 2021-01-15 17:52

Is that possible to redirect to another url with a delay in GAE? I know I can use JavaScript for this purpose, but may be there is a way to do delayed redirection without it

相关标签:
2条回答
  • 2021-01-15 18:29

    import time at the top of your module and do a time.sleep(0.5) before you do a self.redirect call. The sleep argument can take a floating point value of number of seconds to delay. Just make sure that you don't exceed 30 seconds of delay as GAE expects that every request be handled within that otherwise it will be interrupted.

    0 讨论(0)
  • 2021-01-15 18:35

    You can use the <meta http-equiv="refresh" content="x;url=http://yoururl/"> tag where x is the number of seconds to wait before redirect. This tag would go in <head> part of the generated page.

    0 讨论(0)
提交回复
热议问题