0

Can anyone help me on how to add a logo to the index bar in Django-admin site? 1

3 Answers3

1

You should probably override (by extend) the app_index.html admin template.

https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#templates-which-may-be-overridden-per-app-or-model

So you need to create a template/admin directory in your application and override the correct template by adding you own logo.

[Edit]

Oh sorry, you screenshot was too small and I just realized that you’re talking about the icon in the tabbar. That would be the favicon. For that, it’s simple, just add a favicon.ico into your static/ folder, and serve that directly from your http server (probably with a alias).

You can also serve the file directly using a simple view, but that doesn’t seems like a good idea except in development.

Cyrille Pontvieux
  • 2,356
  • 1
  • 21
  • 29
0

Your Question is answered here. You have to override Django base.html template and put it under the admin directory.

https://stackoverflow.com/a/44428576/7122788

Mamed
  • 95
  • 4
  • 16
0

Override the Django base.html template and put it under the admin directory like my_app/templates/admin/base.html

Add {% block extrahead %} to the overriding template.

   {% extends 'admin/base.html' %}
{% load staticfiles %}
{% block javascripts %}
    {{ block.super }}
<script type="text/javascript" src="{% static 'app/js/action.js' %}"></script>

{% endblock %}

{% block extrahead %}
    <link rel="shortcut icon" href="{% static 'favicon.ico'  %}" />
{% endblock %}
{% block stylesheets %}

    {{ block.super }}
{% endblock %}