Django - 图像重叠

时间:2017-05-02 14:49:13

标签: python django matplotlib pillow

我正在开发一个Django应用程序,我需要在模板中显示当前考试的直方图,问题是如果我看到多个考试,图像会重叠。我将在下面的图片中显示。 这是与我检查的第一次检查相对应的直方图 enter image description here

如果我检查另一个考试,这是出现的直方图: enter image description here

但是,如果我重新启动服务器,它就会像下一个图片一样显示。enter image description here

有人知道为什么会这样吗?发布图像显示代码

def showImage(request,exam_id):
  imagePath = '/home/luis/Documentos/projeto/media/examshist/hist'+exam_id+'.png'
  Image.init()
  i = Image.open(imagePath)

  response = HttpResponse(content_type='image/png')
  i.save(response,'PNG')
  return response

0 个答案:

没有答案