django doesnt wait for my time.sleep

181 views
Skip to first unread message

dk

unread,
Mar 4, 2015, 12:03:51 PM3/4/15
to django...@googlegroups.com
i am using matplotlib to generate a plot/graph,  even do that python is generating the file and saving it so I can use it later on in my web page, django show the page before the process finish,
so I decided to put a time.sleep(3)  so it wait 3 sec while all this happen, but doesn't respect that =(

any ideas why that might happen or a workaround?  

I usually get in my web page an old plot so I have to click refresh on the page to get the new actual one =(.
thank.s

Erik Cederstrand

unread,
Mar 4, 2015, 12:35:45 PM3/4/15
to Django Users

> Den 04/03/2015 kl. 18.03 skrev dk <dem...@gmail.com>:
>
> i am using matplotlib to generate a plot/graph, even do that python is generating the file and saving it so I can use it later on in my web page, django show the page before the process finish,
> so I decided to put a time.sleep(3) so it wait 3 sec while all this happen, but doesn't respect that =(
>
> any ideas why that might happen or a workaround?

Please post the relevant code. Without that, it's really just quesswork.

Erik

Bill Freeman

unread,
Mar 4, 2015, 12:59:17 PM3/4/15
to django-users
Sleeping in a web server, which potentially has many users, is considered bad form, even if it works.  A better place for such time outs is in JavaScript in the browser.  Some designs use a view that the JavaScript (or user) can poll to determine when the resource is available.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/536faca6-2abb-4df6-b97d-414cc199e8d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vijay Khemlani

unread,
Mar 4, 2015, 7:04:06 PM3/4/15
to django...@googlegroups.com
Also, why would matplotlib return without having finished its job?

Reply all
Reply to author
Forward
0 new messages