Django doesn't override base admin template

I'm trying to add small customizations to my Django admin panel such as a favicon.

I followed the official guide and have created a base_site.htmlfile in app/templates/admin/.

base_site.html

{% extends "admin/base_site.html" %}
{% load static %}

{% block branding %}
    <img src="{% static 'portal/img/favicon.png' %}" alt="Favicon">
    {{ block.super }}
{% endblock %}

It seems like the template isn't being overridden at all as I don't see an error for not being able to find the favicon / incorrect src (works fine on other pages).

urls.py

from django.contrib import admin
from django.urls import path, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns


sitemaps = {
    'static': StaticViewSitemap,

}
 
urlpatterns = [
    path('admin/', admin.site.urls, name="admin"),
]

urlpatterns += staticfiles_urlpatterns()

Verify that your base_site.html file correctly extends the base template:

{% extends "admin/base.html" %}
{% load static %}
{% block extrahead %}
<link rel="icon" type="image/png" href="{% static 'portal/img/favicon.png' %}" />
{% endblock branding %}

If not helpful, please see : Set favicon in django admin

To override an admin template, the app holding the templates (app, apparently) needs to be listed in INSTALLED_APPS ahead of django.contrib.admin. Is that the case here?

Back to Top