Friday, October 26, 2012

Re: How does threading and processes work in Django

I think what you are looking for is Celery (http://celeryproject.org/).
This handles asynchronous tasks in a clean and tidy manor meaning your
normal requests are free to return their responses while processing
continues. You can check the results of tasks later on in another request.

Regards
Philip

On 26/10/2012 03:56, dwang wrote:
> Hi,
>
> I'm new to Django and need some help understanding how threading works
> in Django. I have some data that I'd like to recompute periodically in
> the background and have it shared between requests. If I start a
> thread in one of the view functions (e.g. my_thread.start()), would
> Django kill this thread at some point? What if I start the thread in
> the main function before entering the server loop?
> Does Django handle each request in a separate process with its own
> interpreter instance?
> Where can I find a good explanation of how thread management works in
> Django?
>
> Any pointers would be greatly appreciated!
> Danyao
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/UlalOvj7a9EJ.
> 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.


--

Philip Mountifield
Formac Electronics Ltd
tel +44 (0) 1225 837333
fax +44 (0) 1225 430995

pmountifield@formac.net
www.formac.net
www.telgas.net

--
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.

No comments:

Post a Comment