Re: Digest for geodjango@googlegroups.com - 1 Message in 1 Topic

6 views
Skip to first unread message

skylar....@gmail.com

unread,
Feb 22, 2010, 12:55:13 AM2/22/10
to geod...@googlegroups.com
You have the correct api key for your production domain?

sent from my baz foone


Date: Mon, 22 Feb 2010 05:47:00 +0000
To: Digest Recipients<geodjang...@googlegroups.com>
Subject: Digest for geod...@googlegroups.com - 1 Message in 1 Topic

Group: http://groups.google.com/group/geodjango/topics

    Ben G <ben...@gmail.com> Feb 21 08:13PM -0800 ^
     
    I'm having a problem with my geodjango app that I can't figure out.
    I'm running django 1.1.1, apache 2.2, mod-wsgi 3.1
     
    I got my app ready using the development server (manage.py
    runserver). Everything works perfectly, no errors and no failures.
    I've run it on a windows machine and a linux machine and it's flawless
    on both. It works under Firefox, Chrome, and Explorer (a few
    formatting problems under explorer)
     
    Then I deployed it on Apache. Everything works, except one feature.
    I have a geocoding function that is triggered by clicking a button and
    selecting a property from a drop down list. The address for the
    property is sent to google geocoder, and the response is parsed into a
    boundbox and the map zooms to the extent (or at least it SHOULD).
    Under Apache the response comes back empty and nothing happens. I
    have tried it under apache 2.2 on a Linux box, a windows box, and I've
    deployed it on webfaction- same result everywhere.
     
    Runserver works, apache doesn't.
     
    The request is sent to google using a POST request. I have another
    POST request in my app that allows users to add a feature to the map;
    the other POST works fine on both production and development servers.
     
    I"m getting no errors in the apache error log, none in firebug, no
    django errors.
     
    Here is the code from views.py for that function:
     
    def lookup(request):
    output_format='json'
    if request.method == 'POST':
    location = request.POST.get('address')
    location = urllib.quote_plus(location)
    geocode = "http://maps.google.com/maps/geo?q=%s&output=%s&key=
    %s" % (location, output_format, settings.GMAPS_API_KEY)
    data = urllib.urlopen(geocode).read()
    json = eval(data)
    if json.get('Status').get('code') == 200:
    bbox = json['Placemark'][0]['ExtendedData']['LatLonBox']
    n,s,e,w =
    bbox['north'],bbox['south'],bbox['east'],bbox['west']
    sw,ne = Point(w,s),Point(e,n)
    e = sw.union(ne).envelope.extent
    bounds = dict(a=e[0], b=e[1], c=e[2], d=e[3])
     
    response = HttpResponse()
    response.write(bounds)
    response['Content-Type'] = "text/json"
    response['Content-Length'] = len(bounds)
    return response
     
    return HttpResponseBadRequest()
     
    Any ideas?
     
    Thanks,
    Ben

     

--
You received this message because you are subscribed to the Google Groups "geodjango" group.
To post to this group, send email to geod...@googlegroups.com.
To unsubscribe from this group, send email to geodjango+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/geodjango?hl=en.
Reply all
Reply to author
Forward
0 new messages