擅长:python、mysql、java
<p><code>StaticFileHandler</code>通常用于为目录提供服务,因此它希望接收一个path参数。来自<a href="http://www.tornadoweb.org/en/stable/web.html#tornado.web.StaticFileHandler" rel="nofollow">the docs</a>:</p>
<blockquote>
<p>Note that a capture group in the regex is required to parse the value
for the path argument to the get() method (different than the
constructor argument above); see URLSpec for details.</p>
</blockquote>
<p>例如</p>
<pre><code>urls = [(r"/(.*)", tornado.web.StaticFileHandler, {"path": "../web"})]
application = tornado.web.Application(urls)
</code></pre>
<p>将为../web中的每个文件提供服务,包括upload.html。</p>