爲什麼這一工作並不:不能得到龍捲風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「})]' –