Search code examples
pythonflaskfavicon

Troubleshooting favicon implementation with Flask


I need help making my favicon show for my otherwise fully-functional webpage written in Python with Flask and served by NGINX and GUNICORN.

I've looked all over google and have seen a few SO posts that reference this, but those have had OPs with favicons that work in some browsers but not in others. Mine has not worked in either Chrome or Safari.

I am following the straightforward documentation and have added the following code to my layout.html file head:

    <!-- Favicon link -->
    <link rel="shortcut icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}">

Note that all other lines in my head are functional (bootstrap links, google font links, etc.)

I have made sure the favicon is a .ico file, located in my static directory within my flasksite directory, with dimensions 16x16.

I use Chrome Incognito mode to look for changes without cache interference.

Finally, I do not see a reference to any favicon errors in the NGINX error logs.

What can I look for to fix this?


Solution

  • Thanks for the comments -- I figured out that I just needed to reset NginX via

    sudo systemctl restart nginx    
    

    and reset Supervisor via

    sudo supervisorctl reload    
    

    I'm posting here in case anyone experiences a similar issue, because these commands weren't suggested in the other posts I read.