application = tornado.web.Application([
(r"/", MainHandler),
(r"/login", LoginHandler),
- (r"/(apple-touch-icon(?:-precomposed)?\.png)", tornado.web.StaticFileHandler,
+ (r"/(apple-touch-icon\.png)", tornado.web.StaticFileHandler, dict(path=settings['static_path'])),
], **settings)
This setting will automatically make all requests that start with `/static/`
In the above settings, we have explicitly configured Tornado to serve `apple-touch-icon.png`
“from” the root with the `StaticFileHandler`, though it is physically in the static file directory.
+(The capturing group in that regular expression is necessary to tell
+`StaticFileHandler` the requested filename; capturing groups are passed
+to handlers as method arguments.)
You could do the same thing to serve e.g. `sitemap.xml` from the site root.
-Of course, you can also avoid faking a root `apple-touche-icon.png`
+Of course, you can also avoid faking a root `apple-touch-icon.png`
by using the appropriate `<link />` tag in your HTML.
To improve performance, it is generally a good idea for browsers to