class MainHandler(BaseHandler):
@tornado.web.authenticated
def get(self):
self.render("index.html", messages=MessageMixin.cache)
所以 MainHandler
不通过 request
或 current_user
至 index.html
.但是在index.html
我试过 <p>{{ current_user }}</p> <p>{{ request }}</p>
然后会生成很多输出。那么这是 Tornado 中的某种“全局变量”吗?
最佳答案
关于python - Tornado - Tornado 中的 'Global variables'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16234033/