Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Display favicon in Heroku Dash app

Hello there,

this is my first post in this forum, so please forgive me if I’m violating any guidelines I’ve overseen.

I recently deployed my first dash web app on Heroku (yeah!) and everything works like a charm so far. However, although I was able to add a favicon in my local app, the favicon fails to be displayed when deployed on Heroku. I was only able to find solutions for this problem for other frameworks - but not for dash.

In the beginning, I had my favicon.ico in an assets/ folder. I then tried moving it to a public/ and to the source directory of my app - but nothing resulted in the display of my favicon.

Do you know if I have to set any paths / tags to point to the favicon in the source code of my app?

Thanks in advance!

Hi Tim

Sorry for getting you excited for nothing. I am simply responding to articulate that I too am experiencing the same issue. I’ve read every guide for flask/dash on deploying a favicon; and mine works fine on my local server, but defaults to the Dash favicon when deployed on Heroku.

If anyone in the community can shed some light on this I’d also appreciate it!

Dan

To further update the community on this. I just want to clarify that I think I’ve exhausted every known avenue and I STILL cannot get my heroku hosted dash app to display a custom favicon. I’m quite new to dash and front end development so I’m sure I’m doing something stupid.

Things I’ve tried

  • I have got whitenoise running, so I can serve static files on heroku deployment, including the favicon.ico to /static and /static/assets (where static becomes root on heroku deployment).
    i.e. I’ve created an assets subfolder within root, so it looks like an identical folder structure to my localhost setup when deployed locally and working fine

  • I’ve tried custom flask callback like so:

@server.route(’/favicon.ico’)
def favicon():
return flask.send_from_directory(os.path.join(server.root_path, ‘static’),
‘favicon.ico’)

If someone can guide me to how to use a developer console or something to watch what is happening at page load perhaps this can shed light on it. I’m sure there must be a way to get favicon’s displaying on Dash-Heroku. Please advise!