|
|
|
@ -17,7 +17,7 @@ tag in your HTML. So, for example:
|
|
|
|
|
|
|
|
|
|
.. sourcecode:: html+jinja |
|
|
|
|
|
|
|
|
|
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}"> |
|
|
|
|
<link rel="shortcut icon" href="{{ url_for('.static', filename='favicon.ico') }}"> |
|
|
|
|
|
|
|
|
|
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`:: |
|
|
|
|