图像无法在django网站的网页上呈现

时间:2018-02-28 13:54:08

标签: html django

所以我正在用Django构建一个网站,在主页上我想渲染一个总是相同的图像。这是我尝试过的。图片和html文件位于同一目录中。

这是html:

<div class="ui segment">
<div class="ui horizontal divider">
View the results
</div>
<img src="3.png" alt="View Results">
</div>

这是我的文件夹的图片:

Folder structure

图像根本没有显示,我只是得到图像无法加载时得到的小图标。

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:2)

您不会将图像放在模板目录中。您将它们放在静态目录中,并通过{ "name": "AzureStorageLinkedService", "properties": { "type": "AzureStorage", "typeProperties": { "connectionString": { "type": "AzureKeyVaultSecret", "secretName": "<secret name in AKV>", "store":{ "referenceName": "<Azure Key Vault linked service>", "type": "LinkedServiceReference" } } }, "connectVia": { "referenceName": "<name of Integration Runtime>", "type": "IntegrationRuntimeReference" } } } 标记引用它们。

请参阅tutorial on static files