我正在学习Django和制作一个电子商务网站。我的文件结构如下:
现在我正在上传一些图片,但无法在网上访问。
{% load static %}
<div class="card" style="width: 18rem;">
<img src='{% static "images/aws.png" %}' class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>上面的例子是一个笑话的一部分。请帮我找我漏掉的东西。如何在我的网页上提供图片链接。1:https://i.stack.imgur.com/Eio3H.jpg
发布于 2022-01-05 16:37:17
我通过更新settings.py文件来解决这个问题。我增加了这一行:
STATIC_DIR = os.path.join(BASE_DIR, "media/static")https://stackoverflow.com/questions/70596025
复制相似问题