[英]Display an image from the database in Django?
I have a read only db that I don't have the ability to change. 我有一个只读数据库,但我无法更改。 I know that it is extremely inefficient to store images in a database. 我知道将图像存储在数据库中效率极低。 However I don't have control over this one. 但是我对此没有控制权。 I need to display the image from the field in the database. 我需要显示数据库中字段的图像。 How can you do this in Django? 您如何在Django中做到这一点?
Don't forget to set the content length in the response. 不要忘记在响应中设置内容长度。 Experiement with 'streaming' if the images are huge. 如果图片很大,请使用“流”进行实验。
https://docs.djangoproject.com/en/1.5/ref/request-response/#httpresponse-objects https://docs.djangoproject.com/zh-CN/1.5/ref/request-response/#httpresponse-objects
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.