How can I get a favicon to show up in my django app?

后端 未结 13 1587
盖世英雄少女心
盖世英雄少女心 2020-12-02 06:50

I just want to drop the favicon.ico in my staticfiles directory and then have it show up in my app.

How can I accomplish this?

I ha

13条回答
  •  生来不讨喜
    2020-12-02 07:44

    The best solution is to override the Django base.html template. Make another base.html template under admin directory. Make an admin directory first if it does not exist. app/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 %}
    

提交回复
热议问题