Rob
Rob

Reputation: 323

Favicon 404 error on Heroku Django deployment

I'm using S3 for static files for my Django Heroku app. All the files show up fine, except the favicon (even after updating my cache). The favicon works locally, but it does not show up on my heroku app. Additionally, Django sends me the following error:

[Django] ERROR (EXTERNAL IP): Internal Server Error: /favicon.ico

My favicon link in my base template is:

<link rel="shortcut icon" href="{{STATIC_URL}}/images/icons/favicon.ico?v=2">

Is there something special I need to do for this file, but not other static files? I've looked around here for answers, but nothing has helped me thus far.

Upvotes: 0

Views: 2254

Answers (1)

jordelver
jordelver

Reputation: 8432

The request for /favicon.ico is being caused by the default behaviour of some web browsers who just assume that the favicon will be present at /favicon.ico.

You could add a 301 redirect to the actual favicon path.

Can you do something like this in your urls.py file?

(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}),

See http://www.codekoala.com/posts/setup-faviconico-django/

Upvotes: 2

Related Questions