From 4f911478e1fdbfddd9e0f985965cdc924534280f Mon Sep 17 00:00:00 2001 From: Alan Hogan Date: Wed, 18 May 2011 19:51:31 -0700 Subject: [PATCH] Typo, restore missing path setting, and mention the capturing group --- website/templates/documentation.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/website/templates/documentation.txt b/website/templates/documentation.txt index d68f378d8..3807fdc9b 100644 --- a/website/templates/documentation.txt +++ b/website/templates/documentation.txt @@ -521,7 +521,7 @@ setting in your application: 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/` @@ -532,8 +532,11 @@ 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. +(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 `` tag in your HTML. To improve performance, it is generally a good idea for browsers to -- 2.47.2