Changing the Default Favicon and Title in Dash App
Dash is a framework for building data visualization apps in pure Python. It’s user-friendly and saves time for backend developers.
In this post I’m going to discuss how to change the title and favicon. Let’s go ahead and learn.
The code for a simple dashboard is as below. Also the browser output for the same is shown below.
# app.pyimport dash
import dash_html_components as html
app = dash.Dash(__name__)
app.layout = html.H1(children='Changing Favicon and Title')
if __name__ == '__main__':
app.run_server(debug=True, port=8888)
Step 1: Changing the Title
add the following line of code to the script,
app.title = 'Favicon'
Step 2: Changing the Favicon
# Current Directory Structure- Favicon Project
- app.py
Add a directory called “assets” and insert the favicon.ico file into this directory.
# Directory Structure after adding favicon.ico to assets directory- Favicon Project
- app.py
- assets
- favicon.ico
# modified app.py to change default titleimport dash
import dash_html_components as html
app = dash.Dash(__name__)
app.title = 'Favicon'
app.layout = html.H1(children='Changing Favicon and Title')
if __name__ == '__main__':
app.run_server(debug=True, port=8888)
Now let’s see the browser output
Now we have seen how to change the default Favicon and Title for Dash Apps. I hope this would make your Dash app look more professional.
Thank you for reading this post. Do comment if you need any help, I will be glad to assist.