From: Alan Hogan Date: Thu, 19 May 2011 02:51:31 +0000 (-0700) Subject: Typo, restore missing path setting, and mention the capturing group X-Git-Tag: v2.0.0~66^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F260%2Fhead;p=thirdparty%2Ftornado.git Typo, restore missing path setting, and mention the capturing group --- 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