在加载base_html时,所有引导CSS都将加载:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link rel="stylesheet" href="{% static "artdb/css/custom.css" %}">
但是当我想加载我的登录页面时,没有加载CSS:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link hrel="stylesheet" href="{% static "artdb/css/signin.css" %}">
我的urls.py:
path('',TemplateView.as_view(template_name='artdb/base.html')),
path('signin/',TemplateView.as_view(template_name='artdb/signin.html')),
有什么想法吗?
两个文件中都有{%load staticfiles%}。有任何想法吗?
答案 0 :(得分:2)
在原始页面中,将自定义样式引用从hrel
更改为rel
<link rel="stylesheet" href="{% static "artdb/css/signin.css" %}">