Re: problem with a graph image in template
Hi, thank you for your response
It seems that there is an error when I asked for help in google
translation
i have
a form
two views: plot(request) who return an httpresponse and
showgraph(request) who return a template (affichage.html)
<form action = "plot/image.png "...> call the function plot(request)
in my views and return an httpresponse with this url (r $' ^plot/
image.png ', 'plot ') the response is just an html file where python
write the image. This works when i call directly the function
plot(request) and ask to return an httpresponse.
The 500 error is when I try to go through show_graph function to
display the response in a template (<form action = "show_graph/
image.png "...> with url (r $' ^show_graph/image.png ', 'show_graph
') : in this template I put just a link to the image, as explained in
the documentation for Django
I think the error is in image.png GET, a python syntax error but I can
not think where (I do not know how to retrieve the trace of a 500
error in django, I installed django debug toolbar) it seems that
python can not write the file with the image ..the content type? ..I
don't understand, .this second view works when i ask an httpresponse
instead of the template
At this time i can run everything by saving the image on the server
disk but it is not an option in production, would require that all
things be done in memory in an HttpResponse
Thanks
On 18 août, 22:16, Reinout van Rees <rein...@vanrees.org> wrote:
> On 17-08-11 21:32, smartaz wrote:
>
> > 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
>
> That url doesn't seem to match the url you gave above. That makes it
> hard to guess what goes wrong.
>
> > If I pass by another view to show picture in a template Django,
> > I have an Internal Server Error 500 systematically
>
> So: what is the error? Getting an error 500 can mean anything from "disk
> full" to "python syntax error".
>
> Perhaps there's a difference that your first example is a POST to that
> image? And <img src=...> means a GET request?
>
> > by putting in the
> > template a simple tag<img src = "Image.png"> in the template
>
> That src attribute again doesn't seem to match your original url.
>
> Reinout
>
> --
> Reinout van Rees http://reinout.vanrees.org/
> rein...@vanrees.org http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home