Adding a favicon
A common question is how to add a favicon to a Flask application. First, ofcourse, you need an icon. It should be 16 × 16 pixels and in the ICO fileformat. This is not a requirement but a de-facto standard supported by allrelevant browsers. Put the icon in your static directory as.
That’s all you need for most browsers, however some really old ones do notsupport this standard. The old de-facto standard is to serve this file,with this name, at the website root. If your application is not mounted atthe root path of the domain you either need to configure the web server toserve the icon at the root or if you can’t do that you’re out of luck. Ifhowever your application is the root you can simply route a redirect:
We can leave out the explicit mimetype and it will be guessed, but we mayas well specify it to avoid the extra guessing, as it will always be thesame.