图像未显示在 django 模板中,

Image is not shown in django template,

我有一个 django 模板,我发送的图像实际上是 email.It 只有当我保持整个 url 像 abc.com/images/a.png 时才有效。 我已经给他发了这样的图片:

{
 'picture':picture.url
}

这是我用于电子邮件模板的模板代码:

<img src="{{picture}}" alt="image" width="200" height="200" >

我错过了什么吗?因为它只有在我保留整个 url?

时才有效

要构建绝对 URL,您可以在视图中使用 request.build_absolute_uri(picture.url)