Home > Software engineering >  Image is not shown in django template,
Image is not shown in django template,

Time:10-26

I have a django template where i send an image actually its for an email.It only works when i keep the whole url like abc.com/images/a.png . i have sent he image like this:

{
 'picture':picture.url
}

This is the code for template that i am using for email template:

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

Am i missing something? as it only works when i keep the whole url?

CodePudding user response:

To build an absolute URL you can use request.build_absolute_uri(picture.url) in your view.

  • Related