[英]What is the correct way to return images from django rest api?
Im creating a Vue single page aplication with DRF backend. 我用DRF后端创建了Vue单页应用程序。 I have images stored in filesystem and one of my models has a field containing the adress of the image.
我将图像存储在文件系统中,并且我的一个模型有一个包含图像地址的字段。
How can i pass the image to the frontend? 我如何将图像传递到前端?
如果html可以访问图像,请尝试此操作
<body> {% for item in imgs %} <img src="{{ item.img_url.url }}"><br/> {% endfor %} </body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.