Document how to fake other root files despite serving with StaticFileHandler
This commit is contained in:
parent
910a0b5436
commit
1100a5239c
|
@ -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 `<link />` 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
|
||||
|
|
Loading…
Reference in New Issue