Skip to content Skip to sidebar Skip to footer

Adding New Handler To Running Python Tornado Server

I'm new to python tornado server, and I were evaluating python tornado for my next project that has to work on real time environment. I've run a sample code from github with Web So

Solution 1:

You'll need the tornado.web.Application's add_handlers method; use it like this:

app.add_handlers(
    r".*",  # match any host
    [
        (
            r"/foo/([^/]*)",
            FooHandler
        ),
        (
            r"/bar/([^/]*)",
            BarHandler
        ),
    ]
)

Judging by its code, it does not block anything.

Post a Comment for "Adding New Handler To Running Python Tornado Server"