set favicon in django admin

前端 未结 4 1694
醉酒成梦
醉酒成梦 2021-02-18 14:08

I need to set up a favicon for django admin interface.

It would be best to do it globally, without overriding templates for all apps.

What is the cleanest way

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-18 14:15

    Override the Django base.html template and put it under 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 }}
        
    
        {% endblock %}
    
        {% block extrahead %}
            
        {% endblock %}
        {% block stylesheets %}
    
            {{ block.super }}
        {% endblock %}
    

提交回复
热议问题