I'm rather new to Django and working on a site that will need to do
the usual Django things by way of serving DB backed dynamic pages.  It
addition it needs to serve JSON and make JSON requests.

For the moment, I'm just experimenting with some very simple tests
using Django's development web server.

I'm able to get JSON responses ok from 'http://localhost:8000/json'
but when I try to access a JSON URI for json_get Django hangs.  If
instead of   'http://localhost:8000/json' I access 'http://
www.google.com' things work.  I assume that there is an issue with
Django's development server that limits it to serving a single view at
a time.  Can anyone verify this?

Thanks for any clues.

Puff


<<<<< code >>>>>

import urllib
from django.http import HttpResponse
from django.utils import simplejson

# test json view
mtj = 'application/json'
mtt = 'text/plain'
mt = mtt

def json(request):
    data = {'first': 'richard', 'last': 'bell'}
    json = simplejson.dumps(data)
    return HttpResponse(json, mimetype=mt)

def json_day(request, day):
    data = {'first': 'richard', 'last': 'bell', 'day': day}
    json = simplejson.dumps(data)
    return HttpResponse(json, mimetype=mt)

def json_get(request):
    print 'in json_get'
    url = 'http://localhost:8000/json'
    #url = 'http://www.google.com'
    f = urllib.urlopen(url)
    print 'got f'
    print f
    doc = f.read()
    print 'got doc %s' % doc
    return HttpResponse('Inside json_get with <<%s>>' % doc)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to