Django load block for css

前端 未结 3 1976
难免孤独
难免孤独 2021-02-04 23:41

I have a few pages. For every page I need load unique css. For all static files I use this. In the head of index.html I have:

{% block css  %}

{% endblock %}


        
相关标签:
3条回答
  • 2021-02-05 00:28

    it is

    {% block css %}
    
    {% endblock %}
    
    0 讨论(0)
  • 2021-02-05 00:38

    You need to use {% load static %} first.

    0 讨论(0)
  • 2021-02-05 00:45

    Your code needs to be refined.

    You are using double quotes, where you need to use an apostrophe.

    Use

    href ="{% static 'css/contact.css' %} "
    

    Instead of

    href ="{% static" css/contact.css" %} "
    
    0 讨论(0)
提交回复
热议问题