On Tue, Feb 3, 2009 at 5:54 PM, adelevie <adele...@gmail.com> wrote:

>
> I am making an api. Part of the api involved serializing data which
> will then be deserialized on another machine. Since I am using the dev
> server, I wrote a view that referenced the api, ie:
>
> def someview(request):
>     data = urllib2.urlopen("http://localhost:8080/some_method/?
> param=foo <http://localhost:8080/some_method/?%0Aparam=foo>")
>     output = []
>     for obj in serializers.deserialize("xml", response):
>          output.append(obj)
>     return HttpResponse("%s" % output[0].some_model_attr)
>
> When I go to localhost:8080/someview, the page loads indefinitely with
> no data brought to the screen. (and my urlconf is correct ;) )
>

>From the development server running on port 8080, while handling a request,
you are trying to get the results of another request from the same
development server?  Yes, this will hang.  The development server is
single-threaded.  So, if you send off a 2nd request while processing a
request, the single thread of the dev server blocks waiting for the response
to the 2nd request.  Meanwhile the 2nd request is queued up waiting for
processing of the 1st request to complete....

See this long recent thread for reasons why and pointers to a patch and
alternative tools you can use for this sort of requirement:

http://groups.google.com/group/django-users/browse_thread/thread/9ae915f9bc3bbfa3/20dffe7a395aa404

Karen

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