good night and first my excuses for my English!!
after several research days I still do not succeed in solving a
probleme of billing of a graph generated with matplotlib and pil in
another view
to be more definite I have a view plot(request) which generates a
graph
 canvas.draw ()
 pil_image = PIL.Image.fromstring (' RGB ', canvas.get_width_height
(),
     canvas.tostring_rgb ())
 pil_image.save (buffer, ' PNG ')
 plt.close ()
 * Django' s HttpResponse reads the buffer and extracts the picture
 response = HttpResponse (buffer.getvalue (), content_type ='image /
png ')
 return response
if I call this view for an url: (r $' ^plot / image.png ', 'contact ')
which comes from a form where I put
<form action = "contact / image.png " name = " SForm " method =
"Post"> {% csrf_token %}
the graph is correctly displayed as picture in a page html
http: // 127.0.0.1:8000 / graphs / contact / image.png
If I pass by another view to show picture in a template Django,
I have an Internal Server Error 500 systematically by putting in the
template a simple tag <img src = "Image.png"> in the template
I tried everything in the second view: a simple to render
def show_graph (Request):
 return render_to_response (' Graphs / affichage.html ',
context_instance=RequestContext (request))
 I tried to remind of the function of view plo by returning the data
of the form
def show_graph (Request):
 request.session = request. POST
 session = SessionStore ()
 session.save ()
 response = contact (request)
 return render_to_response (' Graphs / affichage.html ',
context_instance=RequestContext (request))
I always have the same error.
Is what anybody can see that I hurt and that causes this error?
Thank you in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to