1

what ever i try to do i can't get the favicon to show up, when i look it up in the view source tab it loads up but won't appear in the tab icon position.

i'm importing it in the html like so:

{% load static %}
<link rel="stylesheet" href="{% static "css/index.css" %}"/>
<link rel="Favicon" type="image/png" href="{% static 'images/icon.png' %}"/>

i set the django staticfile_dirs like so:

STATICFILES_DIRS = [
    os.path.join('static'),
    os.path.join('static/images'),
    ]
rediet yosef
  • 192
  • 1
  • 15

3 Answers3

1

Try .ico format instead of .png format and rel="shortcut icon" or rel="icon"

NKSM
  • 5,422
  • 4
  • 25
  • 38
1

The value of the rel="…" attribute should be icon [mdn webdocs], not Favicon:

<link rel="icon" type="image/png" href="{% static 'images/icon.png' %}"/>
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
0

If your image loads in the browser, you need to have the favicon link be rel="icon" rather than rel="Favicon".

See Do you have to include <link rel="icon" href="favicon.ico" type="image/x-icon" />?

Additionally, you can add a URL route called "favicon.ico" that returns your file.

If your image doesn't load, there is a problem with your static asset serving: https://docs.djangoproject.com/en/dev/howto/static-files/

Zags
  • 37,389
  • 14
  • 105
  • 140