Matplotlib into a Django Template

后端 未结 5 2097
时光取名叫无心
时光取名叫无心 2021-01-02 03:17

Im using python 3.4 and Django 1.8. I want to \"print\" a matplotlib result in a Django template. I reach this a few days ago, so I continue in other things of my Django App

5条回答
  •  抹茶落季
    2021-01-02 03:27

    I had a broken icon image as well, after using the answers above, and I fixed it by removing the b' and ' from the graphic base64 binary representation :

    return render(request, 'graphic.html', {'graphic': str(graphic)[2:-1]})

提交回复
热议问题