Tornado – Redirection

Redirections are essential while developing a website. What if you need to redirect a user from a page to home page based on an event? Tornado supports redirection.

In the example below,

  • When you run tornadoredirection.py and open a browser at http://127.0.0.1:8888, you would notice a message, ‘It Works!’ which suggests Tornado Web Server is up and running.
  • On browsing to http://127.0.0.1:8888/article (HTTP GET), you would notice message ‘Page on articles’ with a button ‘Home’.
  • Button ‘Home’ is a html file that submits a Post request on ‘/article’ page. Class Article  handles this HTTP POST request and redirects itself to home page(‘/’).

https://gist.github.com/3186793.js

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.