我有一个404请求处理程序来处理像http://host:port/mycompany这样的情况。这是代码。
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", HomeHandler),
(r"/mycompany", myCompanyHandler),
]
super(Application, self).__init__(handlers, default_handler_class=my404Handler)
class myBaseHandler(tornado.web.RequestHandler):
def write_error(self, status_code, **kwargs):
if status_code == 404:
self.render("404.html")
else:
self.render("genericerror.html")
class my404Handler(myBaseHandler):
def prepare(self):
raise tornado.web.HTTPError(404)
class HomeHandler(myBaseHandler):
def get(self):
self.render("home.html")
class myCompanyHandler(myBaseHandler):
etc
etc
etc
我想在用户输入http://host:port/mycompany/时显示404页面(注意结尾处的正斜杠)。我错过了什么?
由于