It is possible to run view method in new thread? For example if i have (r'^items/(?P<category>\d)/$', 'cyber.core.views.list_items') and function list_items do sleep(10) a new requests to django application will not be acceptable, cause main thread is currently sleeping by list_items function. So any ideas? (sorry for poor english) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~--- |
Why do you sleep(10) ? I can't think of any possible reason... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~--- |
orestis wrote: > Why do you sleep(10) ? I can't think of any possible reason... It's only example which is simulating very big system load. I want to create application which will be creating threads with nonblocking tasks list (in queue). If application has new request - he's adding new task to list, but previous tasks can be not completed. It's hard to describe... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~--- |
In reply to this post by pako
On Fri, 2006-10-13 at 11:18 -0700, pako wrote: > It is possible to run view method in new thread? > For example if i have > > (r'^items/(?P<category>\d)/$', 'cyber.core.views.list_items') > > and function list_items do sleep(10) a new requests to django > application will not be acceptable, cause main thread is currently > sleeping by list_items function. > So any ideas? No, Django doesn't have a built-in facility to do this. It just doesn't make a lot of sense for the web-page presentation side of a framework. If you have a task that is going to do a heavy computation, it is up to you to fork off a new process or run it in a thread. Since you can put anything you like in your view, this means you can choose whatever library or code you want to manage this dispatching. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~--- |
In reply to this post by pako
pako wrote: > It is possible to run view method in new thread? > For example if i have > > (r'^items/(?P<category>\d)/$', 'cyber.core.views.list_items') > > and function list_items do sleep(10) a new requests to django > application will not be acceptable, cause main thread is currently > sleeping by list_items function. > So any ideas? > > (sorry for poor english) > hi, what you describe is usually solved in a different way. simply the webserver that is calling the django-views will already be doing it from multiple processes or threads (depends on your webserver + configuration), so it does not have to be handled on the django-level. gabor --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~--- |
gabor wrote: > pako wrote: > > It is possible to run view method in new thread? > > For example if i have > > > > (r'^items/(?P<category>\d)/$', 'cyber.core.views.list_items') > > > > and function list_items do sleep(10) a new requests to django > > application will not be acceptable, cause main thread is currently > > sleeping by list_items function. > > So any ideas? > > > > (sorry for poor english) > > > > hi, > > what you describe is usually solved in a different way. > > > simply the webserver that is calling the django-views will already be > doing it from multiple processes or threads (depends on your webserver + > configuration), so it does not have to be handled on the django-level. > Yes, you've right. I see it now. Problem was when i was testing only by django httpd server. I tested my application on apache2 and it works fine. Thx. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~--- |
Free forum by Nabble | Edit this page |