0

I am running a django project on heroku. After seeing that my favicon.ico won't load, I decided to see if it was working when visiting my page example.com/favicon.ico.

What I saw (on multiple browsers) is a dead image like this: https://app.box.com/s/q9uqb2kmooak93ockvbl

I am serving the favicon.ico like so:

<link rel="shortcut icon" href="{% static 'favicon.ico' %}" type="image/x-icon"/>

Also, I should mention I am redirecting the url in my django project like this:

#serving favicon
(r'^favicon\.ico$', RedirectView.as_view(url='/static/favicon.ico')),

That shouldn't matter though.

I am wondering if this is a problem:

  1. with the image I am trying to render (though I doubt it since other images render fine)
  2. a problem with heroku
  3. or a problem with the shortcut icon reference link?

Here are the settings to my static just incase:

STATIC_URL = '/static/'

# only refers to the location where your static files should end up after running manage.py collectstatic. you shouldn't really need collectstatic) when developing locally
STATIC_ROOT = 'staticfiles'


STATICFILES_DIRS = (    
    os.path.join(BASE_DIR, '../static'),
)

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(BASE_DIR, '../templates'),
)


# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

Any ideas?

ApathyBear
  • 9,057
  • 14
  • 56
  • 90
  • you can add alias in virtual host refer to [this][1] Question [1]: http://stackoverflow.com/questions/21938028/how-can-i-get-a-favicon-to-show-up-in-my-django-app/27921872#27921872 – Saurabh Chandra Patel Jan 13 '15 at 12:12

1 Answers1

1

** Updated based on update **

I would try removing the special call out for the favicon in your URLs, and just let the icon serve itself like any other image. I suspect you're getting double redirection.

aronchick
  • 6,786
  • 9
  • 48
  • 75
  • http://www.example.com/static/favicon.ico is the link that is forwarded to that contains the dead image. I can post the ACTUAL if needed. Also I believe my settings for static are correct. I have added them to the OP. All my other static images seems to be working fine.. – ApathyBear Oct 01 '14 at 23:15
  • would I need to put my favicon.ico in my root then? or just use the and keep it where it is? And does double redirection even matter? – ApathyBear Oct 01 '14 at 23:23
  • You would probably put it in your static images, since you said that's where it's rendering from. – aronchick Oct 01 '14 at 23:27