From b23b306d2eb8def8610eb85910e6b4be94f52bab Mon Sep 17 00:00:00 2001 From: Dag Odenhall Date: Thu, 20 Jan 2011 17:01:46 +0100 Subject: [PATCH] Fixes for the Favicon pattern docs --- docs/patterns/favicon.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/patterns/favicon.rst b/docs/patterns/favicon.rst index 6cf64ea0..edb2d0e5 100644 --- a/docs/patterns/favicon.rst +++ b/docs/patterns/favicon.rst @@ -17,7 +17,7 @@ tag in your HTML. So, for example: .. sourcecode:: html+jinja - + That's all you need for most browsers, however some really old ones do not support this standard. The old de-facto standard is to serve this file, @@ -26,8 +26,9 @@ the root path of the domain you either need to configure the webserver to serve the icon at the root or if you can't do that you're out of luck. If however your application is the root you can simply route a redirect:: - app.add_url_rule('/favicon.ico', - redirect_to=url_for('static', filename='favicon.ico')) + @app.route('/favicon.ico') + def favicon(): + return redirect(url_for('.static', filename='favicon.ico')) If you want to save the extra redirect request you can also write a view using :func:`~flask.send_from_directory`::