how would I embedded generated image inside django template?
something like
return render_to_response(\'graph.html\', { \'img\': get_graph() })
You can map a URL to one of your view functions that returns an HttpResponse with image data and use this URL as the src for your
element e.g.
urls.py
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^image/', 'views.get_image'),
)
views.py
from django.http import HttpResponse
def get_image(request):
image_data = get_graph() # assuming this returns PNG data
return HttpResponse(image_data, mimetype="image/png")
index.html