为什么这一工作并不:不能得到龙卷风staticfilehandler工作
application = tornado.web.Application([(r"/upload.html",tornado.web.StaticFileHandler,\
{"path":r"../web/upload.html"}),])
if __name__ == "__main__":
print "listening"
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
击中
http://localhost:8888/upload.html throws:
TypeError: get() takes at least 2 arguments (1 given)
ERROR:tornado.access:500 GET /upload.html (::1) 6.47ms
我曾尝试在互联网上进行搜索,但好像我的使用是完全正确的。 所以我找不到为什么它不工作。互联网上的大多数例子都是关于为一个完整的目录提供一个静态处理程序。那么情况就是这样,它不适用于单个文件?
如果你只是想提供一个鱼贯而出的目录,你可以通过将在正则表达式的文件名和目录的路径参数做到这一点:'[(R“/(上传\ .html)“,StaticFileHandler,{”path“:”../ web“})]' –