【发布时间】:2019-08-21 07:23:48
【问题描述】:
加载 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 %}。有任何想法吗?
【问题讨论】:
-
应该是
{% load static %}而不是{% load staticfiles %}。
标签: python css django bootstrap-4