WebFaction
Community site: login faq
0
2

How do I put an icon for my site (a django based site). ie, the icon that shows up in the address bar of a browser or the tab in a browser.

asked 24 Nov '10, 22:24

rsp
141612
accept rate: 0%


You can also do this in your urls.py file

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

answered 25 Nov '10, 01:34

lamusoftware
1971517
accept rate: 16%

This solution is ok however using dynamic code to always serve the same is kind of a mood point.

(30 Nov '11, 13:28) elpargo

You should be able to use the following in your httpd.conf:

LoadModule alias_module modules/mod_alias.so

<Location "/favicon.ico">
    SetHandler None
</Location>

alias /favicon.ico /home/<username>/webapps/media/favicon.ico

The same method can also be used to serve a "robots.txt" file.

permanent link

answered 24 Nov '10, 22:42

ryans ♦♦
5.0k93460
accept rate: 43%

edited 24 Nov '10, 22:43

I've found that it works without the <Location... tag, just the LoadModule and Alias.

(18 Aug '12, 07:04) cek

Or even more simple would be to put the .ico file in your static media directory and have nginx serve it. it is technically an image file, so it works quite well

<link rel="icon" href="{{ MEDIA_URL }}favicon.ico" type="image/x-icon"/>
permanent link

answered 30 Nov '10, 13:42

esatterwhite
1
accept rate: 0%

Doesn't always work as a lot of applications/ browsers just assume the /favicon.ico location

(30 Nov '10, 14:21) lamusoftware

for example?

(30 Nov '10, 16:02) esatterwhite

For example google+

(30 Nov '11, 13:26) elpargo

You're saying you visit websites with google+?

(30 Nov '11, 19:51) esatterwhite

I know this is old, but the favicon indeed doesn't work this way in some browsers. For example in google chrome. I have a favicon setup using the tag rel, but still showing nothing. The alias idea solved the problem. ;)

(11 Jul '13, 20:27) kalkehcoisa
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×2

question asked: 24 Nov '10, 22:24

question was seen: 12,516 times

last updated: 11 Jul '13, 20:27

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM