Thank you for explaining that the ports were the issue. My little
workaround is to simply run two dev servers:
from command line: python manage.py runserver 8080
then open another command line window: python manage.py runserver 8000
So in my views, the url I access is on port 8080. So when I access my
api through a browser, I use localhost:8000.
On Feb 3, 6:15 pm, Karen Tracey <
kmtra...@gmail.com> wrote:
> 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/9ae9...
>
> Karen