Favicon.ico Not Found

favicon.ico not found

Favicon.ico Not Found

 |   |  1
Django Programming

favicon.ico Not Found in Django? What is this warning about and how do I get rid of it?

Most browsers look for the existence of an file called favicon.ico at the root path of your website domain, this controls the icon for the website you can see in your bookmarks folder or the address bar of your browser.

If you don’t have one, then it’s valid that it would return a Not Found error.

So let’s get right to it.

Error

Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[14/May/2019 09:02:50] "GET /favicon.ico HTTP/1.1" 302 0
[14/May/2019 09:02:50] "GET /static/images/favicon.ico HTTP/1.1" 404 1779

When you deploy to something like Apache, you will have to alias your favicon in a config file. However, while running Django in development mode, the following works.

djangotestproject/urls.py

from django.views.generic import RedirectView
url_patterns=[
    ...
    url(r'^favicon\.ico$',RedirectView.as_view(url='/static/images/favicon.ico')),
]

And this is all that is required to fix the not found warning Python in Django.


41 Claps

Show your love in the form of Claps and Comments...

Comments...

Azizbek - 

comment