2

I receive the Broken INTERNAL link error message email frequently, complaining that favicon.ico is not found. I have dedicated favicon in my base template and it is located in my static folder. The main templates show favicon and there is no error message. However, I don't know how to specify favicon for the admin templates.

1man
  • 5,216
  • 7
  • 42
  • 56

1 Answers1

1

I found the answer at Setup a favicon.ico in Django. However, the article is too old and in the new versions of Django the "redirect_to" is deprecated. So, the solution that I used is to add the following pattern in urls.py:

from django.conf.urls import url
from django.views.generic.base import RedirectView
from django.conf import settings

from . import views

urlpatterns = [
    url(r'^favicon\.ico$', RedirectView.as_view(url=settings.MEDIA_URL + 'Path_to_favicon_file')),
]
1man
  • 5,216
  • 7
  • 42
  • 56
  • 1
    This is almost the exact same as [wims answer on the duplicate](http://stackoverflow.com/a/21938270/1324033) (not my downvote) – Sayse Mar 13 '16 at 18:04