繁体   English   中英

Django 中的文件结构

[英]File Structure in Django

我正在学习 Django 并制作电子商务网站。 我的文件结构如下:[![我的项目文件结构][1]][1]

现在我正在上传一些图片,但无法在 web 中访问。

{% 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>

上面的例子是carousal 的一部分。 请在我遗漏的地方提供帮助。 如何在我的 web 中提供指向图像的链接。 [1]: https://i.stack.imgur.com/Eio3H.jpg

是的,我通过更新 settings.py 文件解决了这个问题:我添加了这一行

STATIC_DIR = os.path.join(BASE_DIR, "media/static")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM