Favicon with Django on iPhone, Android, Desktop, Windows and all the family

Favicon with Django on iPhone, Android, Desktop, Windows and all the family

Published April 28, 2016 in Development, Web - Last update on April 28, 2016.

Every web developer has already play with favicon.ico, the simple tag for add an icon on browser tabs or starred page. For noobies it's:

<link rel="icon" href="/favicon.ico">

But nowadays with all the existing client platforms just this tag isn't sufficient. There are Apple devices, Android, Windows (huch) for display your icon on Home screen or favorites.

Another thing that make me freaking, I saw a lot of blog post that suggest to create a view for favicon and serve it through WSGI daemon. This goes in the opposite direction of what I think: Favicon are BLOB and should be delivered like every static file by the static file storage.

For those who really want to have them icon in root of its website, your web frontent is here (location /favicon.ico { alias /var/www/favicon.ico; } with Nginx). But it's not the topic of this blog post, I would like to present Django Super Favicon. Yes, sorry for "Super", Django Favicon already exists and Django Favicon Plus too.

I've had the idea when tried the Real Favicon Generator.net, it is a very useful tool, you provide only a source image and it will create resized icons following favicons best pratice, cherry on the cake it gives you HTML tags for use icons. I saw it and immediatly think: "Does it exist tool like that in Django community ?". Fortunately Yes, but these tool either make the mistake to create favicon view or use models.ImageField to store files. So I wrote this project and it does the following things:

  1. Create favicons in many format from a source image, this image can be stored in filesystem, static storage or HTTP(S) server
  2. Upload generated images to static file storage (or other if defined)
  3. Included favicons' tags simply in your HTML

This website is actually using it, and obviously it is a free software. Feel free to comment or make PRs.

Links and references

Real Favicon Generator.net - An online tool for create all things explained in this article from an uploaded file

Favicon Cheatsheet on Github


No comments yet.

Post your comment

Comment as . Log out.