Tornado iframe src

2019-08-31 16:43发布

I am trying to use an iframe in the following way:

<iframe src="????" width="350" height="500"></iframe>

where the Tornado server look like this:

class FrameHandler(RequestHandler):
    def get(self):
        user = self.get_argument("username")
        self.set_cookie("user", user)
        out = tableizer(user)
        self.render('messages.html',table=out)

application = tornado.web.Application(
    [
        (r"/frame", FrameHandler),
    ], 
    debug=True,
    template_path=os.path.join(os.path.dirname(__file__), ""),
    static_path=os.path.join(os.path.dirname(__file__), "static"),
)

How do I get my iframe to display messages.html?

1条回答
一夜七次
2楼-- · 2019-08-31 16:59

The handler looks good. You only need to substitue ???? in

<iframe src="????" width="350" height="500"></iframe>

with:

<iframe src="/frame?user=whoever" width="350" height="500"></iframe>
查看更多
登录 后发表回答