Last active
October 4, 2022 17:06
-
-
Save iepathos/5350503 to your computer and use it in GitHub Desktop.
Fix for Google Chrome favicon loading in Django. You may have noticed that Chrome has issues loading the appropriate favicon on Django if you have it in a different path other than just '/favicon.ico'. Firefox follows the template icon links no problem, but Chrome needs a little more help. I fixed this issue by adding this quick line to the urls…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#urls.py | |
from django.conf import settings | |
urlpatterns = patterns('', | |
url(r'^favicon.ico/$', lambda x: HttpResponseRedirect(settings.STATIC_URL+'ico/favicon.ico')), #google chrome favicon fix | |
) | |
# base.html | |
<link rel="shortcut icon" href="{{ STATIC_URL }}ico/favicon.ico"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
on django 3.1.5, it works, thanks