DJANGO网站:html代码找不到要在my pag中显示的jpg位置

2024-09-27 21:32:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我制作了一个Django网站,并从w3中提取了一个模板。我试图用我自己的图片替换他们使用的标题的jpg,但是网页找不到我的图片的src。我的文件夹目录如下:

- Website
    -websiteFirst
        -blog
            -migrations
            -static (files inside)
            -templates (files inside)
            -init
            -admin
            -apps
            - rest of usual scripts for django
        -WebsiteFirst
            -init
            -settings
            -urls
            -wsgi

我在我的项目文件夹中尝试了尽可能多的不同文件夹的变体

这是一些不同尝试的错误代码:

[06/May/2019 16:51:04] "GET /backgroundwebsite.jpg HTTP/1.1" 404 2113
[06/May/2019 16:51:04] "GET /blog/ HTTP/1.1" 200 7780
Not Found: /websiteFirst/blog/backgroundwebsite.jpg
[06/May/2019 16:51:04] "GET /websiteFirst/blog/backgroundwebsite.jpg HTTP/1.1" 404 2167
Not Found: /backgroundwebsite.jpg
[06/May/2019 16:51:04] "GET /backgroundwebsite.jpg HTTP/1.1" 404 2113



<div class="w3-padding-large" id="main">
    <!-- Header/Home -->
  <header class="w3-container w3-padding-32 w3-center w3-black" id="home">
    <h1 class="w3-jumbo"><span class="w3-hide-small"></span> Garrett Young.</h1>
    <p>Recent University Of British Columbia Graduate, Prospective Data Scientist, and DJ.</p>
    <img src="/backgroundwebsite.jpg" alt="boy" class="w3-image" width="992" height="1108">
  </header>

该图像是从模板中的一个网站显示的,但我现在正试图从我的个人电脑中获取它


Tags: src文件夹模板httpget网站图片blog

热门问题