Fixes for the Favicon pattern docs
This commit is contained in:
parent
384ad219cb
commit
b23b306d2e
1 changed files with 4 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ tag in your HTML. So, for example:
|
||||||
|
|
||||||
.. sourcecode:: html+jinja
|
.. 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
|
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,
|
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
|
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::
|
however your application is the root you can simply route a redirect::
|
||||||
|
|
||||||
app.add_url_rule('/favicon.ico',
|
@app.route('/favicon.ico')
|
||||||
redirect_to=url_for('static', filename='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
|
If you want to save the extra redirect request you can also write a view
|
||||||
using :func:`~flask.send_from_directory`::
|
using :func:`~flask.send_from_directory`::
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue