How to Add a Favicon to a Web page in Django


In this article, we show how to add a favicon to a web page in Django.

A favicon is an icon that appears on the tab of a web browser.

It helps to give the website more of a brand than if there is no favicon.

This page assumes you have already created the favicon and just want to see how to put it on your site in Django. However, if you have not created your favicon, you can just create one at the following site:

There will produce a favicon, which is a file that has a .ico ending (standing for icon).

A favicon really is a static file, so the favicon file that you have can be put in the images directory in the static directory.

So this is where you put your file.

Then on the page, where you want to insert the favicon, you add the following line below in between the <head></head> tags.

Once you have added this to the HTML file and run the code, then you should see the favicon (icon) appear on the tab of a web browser.

If you want to add the favicon to other pages (almost all websites have a favicon on every page of the site), for each page, you add the line above.

If you are dealing with templates on another app, then you need to add the favicon to the images directory of the static directory in that app.

And this is all that is needed to add a favicon to a website page in Django.

Related Resources

How to Show All Tables of a MySQL Database in Python

How to Count the Number of Rows in a MySQL Table in Python

HTML Comment Box is loading comments...