Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 我可以在django中的CSS文件上加载静态文件夹吗_Html_Css_Django - Fatal编程技术网

Html 我可以在django中的CSS文件上加载静态文件夹吗

Html 我可以在django中的CSS文件上加载静态文件夹吗,html,css,django,Html,Css,Django,在我的CSS中,我需要加载一个图像作为我页面的背景,如下所示: style.css background: url("media/images/hero-bg.jpg") no-repeat center; 但一旦我移动了it服务器,这就行不通了。我想,我能像这样在一个常规HTML文件中这样做吗: index.html: {% load static %} <p data-aos="fade-right" data-aos-delay="

在我的CSS中,我需要加载一个图像作为我页面的背景,如下所示:

style.css

background: url("media/images/hero-bg.jpg") no-repeat center;
但一旦我移动了it服务器,这就行不通了。我想,我能像这样在一个常规HTML文件中这样做吗:

index.html:

{% load static %}
<p data-aos="fade-right" data-aos-delay="200"><img class="mr-4" src="{% static 'images/slider1.png' %}" alt="404 not found">
{%load static%}

我的问题是,如果我使用相同的语法,它会正常工作还是需要对代码进行修改