Re: dev server not loading localhost urls

2009-02-03 Thread adelevie

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  wrote:
> On Tue, Feb 3, 2009 at 5:54 PM, adelevie  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 ")
> >     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
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: dev server not loading localhost urls

2009-02-03 Thread Karen Tracey
On Tue, Feb 3, 2009 at 5:54 PM, adelevie  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 ")
> 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
-~--~~~~--~~--~--~---



dev server not loading localhost urls

2009-02-03 Thread adelevie

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")
 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 ;) )
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---