From 1100a5239ca0c572141dd1e698ffca4f2b377986 Mon Sep 17 00:00:00 2001 From: Alan Hogan Date: Sun, 15 May 2011 12:05:13 -0700 Subject: [PATCH] Document how to fake other root files despite serving with StaticFileHandler --- website/templates/documentation.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/templates/documentation.txt b/website/templates/documentation.txt index 746c4974..d68f378d 100644 --- a/website/templates/documentation.txt +++ b/website/templates/documentation.txt @@ -521,6 +521,7 @@ setting in your application: application = tornado.web.Application([ (r"/", MainHandler), (r"/login", LoginHandler), + (r"/(apple-touch-icon(?:-precomposed)?\.png)", tornado.web.StaticFileHandler, ], **settings) This setting will automatically make all requests that start with `/static/` @@ -529,6 +530,12 @@ will serve the file `foo.png` from the specified static directory. We also automatically serve `/robots.txt` and `/favicon.ico` from the static directory (even though they don't start with the `/static/` prefix). +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. +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` +by using the appropriate `` tag in your HTML. + To improve performance, it is generally a good idea for browsers to cache static resources aggressively so browsers won't send unnecessary `If-Modified-Since` or `Etag` requests that might block the rendering of