我正在尝试将图像添加到我的引导轮播中,但是图像未加载。
{% extends 'base.html' %}
{% block html %}
{% load static %}
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="/Users/myname/Documents/django/ldn/static/images/phone.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="{% static 'static/images/network.jpg' %}" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="../static/images/phone.jpg" alt="Third slide">
</div>
</div>
</div>
</body>
</html>
{% endblock %}
我已经尝试了如上所示的各种方法,但是没有用。我的static / images文件夹在我的项目根目录中。谢谢
答案 0 :(得分:1)
{% load static %}
<html lang="en">
<body>
<img src="{% static 'img/logo.png' %}" >
</body>
</html>