Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Delicate Tornado Route Decorator.

Project Description

import tornado.ioloop
import tornado.web

from toroute import route

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")

@route('/login', name='login')
class LoginHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):

# group by `/blog`, e.g.: blog app
@route('/list', name='blog_list', kwargs={'data': 'hello'}, group='/blog')
class BlogListHandler(tornado.web.RequestHandler):
def initialize(self, **kwargs): = kwargs.get('data', None)

def get(self, *args, **kwargs):

@route('/post', name='blog_post', group='/blog')
class BlogPostHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
print('post complete! redirect:%s' % route.url_for('blog_list'))

@route(r'/view/(?P<pid>\d+)/detail', name='blog_view', group='/blog')
class BlogViewHandler(tornado.web.RequestHandler):
def get(self, pid, **kwargs):
msg = 'Handle Class for /blog/list is %s' \
% route.get_handler_class('/list', group='/blog').__name__

if __name__ == '__main__':

application = tornado.web.Application([
(r"/", MainHandler),
] + route.routes())

Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
torroute-0.0.1.tar.gz (1.4 kB) Copy SHA256 Checksum SHA256 Source Aug 26, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting