Elsporko
Elsporko

Reputation: 561

Python Tornado handler behavior

I am playing with Python Tornado and have what should be a very basic question.

As I understand the code snippet below invoking either localhost:3000 or localhost:3000/register should direct me to register.html but for whatever reason localhost:3000 successfully takes me to the page where localhost:3000/register produces a 404. What subtlety am I overlooking?

Thanks.

class RegisterHandler(tornado.web.RequestHandler):

def post(self):
    self.render("register.html")

-------------------------------

options.parse_command_line()
app = tornado.web.Application(
    [
        (r'/',         RegisterHandler),
        (r'/register', RegisterHandler),
    ],
    debug=True
)
app.listen(options.port)
logging.info("app started, visit http://localhost:%s" % options.port)
tornado.ioloop.IOLoop.instance().start()

Upvotes: 0

Views: 205

Answers (1)

A. Jesse Jiryu Davis
A. Jesse Jiryu Davis

Reputation: 24007

I just tried your code on my machine with the latest Tornado and it works as you expect.

Upvotes: 1

Related Questions