Images from ImageField in Django don't load in template

后端 未结 7 1415
温柔的废话
温柔的废话 2020-12-08 15:58

I\'m building a gallery using Django(1.5.1) on my local machine. In my Album model I have a ImageField. There is a view to show all images of an album. It works

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 16:24

    Within your details.html, change your

    img src="{{ image.image.url }}" height="420"
    

    To

    img src="your_app/media/{{ image.image.url }}" height="420"
    

    I hope this helps. If not I will be glad to provide more details.

提交回复
热议问题