嘿,我正在努力在我的服务器上使用 Python 和 Tornado 下载一个静态文件。
class templateHandler(tornado.web.RequestHandler):
def get(self):
self.write("""
<a href="/download"> Download </a>
""")
application = tornado.web.Application([
(r"/", MyFormHandler),
(r"/results", MyFormHandler),
(r"/multi", MyFileHandler),
(r"/upload",MyFileHandler),
(r'/download',tornado.web.StaticFileHandler,{'path':"L:/Template.csv"}),
(r'/template', templateHandler),
(r"/SFA",SFAHandler),
])
有人可以帮我吗。我不是 100% 确定文件处理程序是如何工作的。谢谢你的帮助!
编辑:这是错误消息:
ERROR:root:Uncaught exception GET /download (10.18.4.160)
HTTPRequest(protocol='http', host='IPadress', method='GET', uri='/download', version='HTTP/1.1', remote_ip='IPaddress', body='', headers={'Connection': 'keep-alive', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', >'Referer': 'IPadress/template', 'Host': 'IPaddress', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0'})
Traceback (most recent call last):
File "WEB.PY LOCATION", line >988, in _execute
getattr(self, self.request.method.lower())(*args, **kwargs)
TypeError: get() takes at least 2 arguments (1 given)
ERROR:root:500 GET /download (IPaddress) 0.00ms