Including page titles, favicon, etc in dash app?

If you’re happy with Flask serving the favicon, then one option is to add an explicit route for it. Here’s how I got it working:

from dash import Dash
from flask import Flask, send_from_directory

server = Flask(__name__, static_folder='static')
app =  Dash(server=server)

@server.route('/favicon.ico')
def favicon():
    return send_from_directory(os.path.join(server.root_path, 'static'),
                               'favicon.ico', mimetype='image/vnd.microsoft.icon')

And copy your favicon into the ‘static’ directory which should be in the same directory as the app file.

7 Likes