I remember I had some difficulty getting this to work, and yes I did have to
modify the downloadable code. In template.py try substituting your app's url
+ key in JSAPI_KEYS. As I said before, you may want to substitute your key
in index.html like so:
<script type="text/javascript" src="http://www.google.com/jsapi?key=your_key
"></script>
then, work backwards to get your key in templatelib.py to work for you. I'm
not certain how much a security issue this is. I think this should work for
test purposes at least.

With respect to the database call, it is made in front.js using ajax. See
function doGeocodeAndSearch() & function doSearch(options). I then
substituted the my app's url in function doSearch(options) as shown below:

g_currentSearchXHR = $.ajax({
    url: 'http://your_app.appspot.com/s/search', //see your app.yaml file
for the call to service.py
    type: 'get',
    data: searchParameters,
    dataType: 'json',
    error: function(xhr, textStatus) {
      // TODO: parse JSON instead of eval'ing
      var responseObj;
      eval('responseObj=' + xhr.responseText);
      $('#search-error, #list-view-status').text(
          'Internal error: ' + responseObj.error.message);
      $('#search-error').css('visibility', 'visible');
      $('#loading').css('visibility', 'hidden');
    },
    success: function(obj) {
      g_currentSearchXHR = null;

      $('#loading').css({ visibility: 'hidden' });

      if (!options.clearResultsImmediately)
        clearSearchResults();

      if (obj.status && obj.status == 'success') {

        for (var i = 0; i < obj.results.length; i++) {
          var result = obj.results[i];

          result.icon = '
http://your_app.appspot.com/static/images/markers/simple.png';
          if (options.type == 'proximity' && i <= 10) {
            result.icon = '
http://your_app.appspot.com/static/images/markers/' +
                String.fromCharCode(65 + i) + '.png';
          }

....


What that ajax call does is call service.py as defined in your app.yaml
file. Look at service.py to see how the actual call to the database is
defined.

This worked for me. I hope this helps. Good luck!


On Thu, Nov 25, 2010 at 4:03 AM, kualoa1 <[email protected]> wrote:

> Thank you.  I have entered the correct ket in the index.html ... I did
> not modify templatelib.py.  I see it has three keys specified.  not
> clear what is going on there.  still in the dark!  did you make any
> mods to the "downloadable code" or did it start directly for you?
>
> on the database ... where is a call referenced to it?  do you have an
> example, however small, that you can share with me so I can try it?  I
> would like to eliminate that from getting the app going and then come
> back to develop the full database.  are you using a full version?
> (100K records?)
>
> Thank you.
>
> On Wed, Nov 24, 2010 at 8:28 PM, Malcolm MacKinnon <[email protected]>
> wrote:
> > No, I'm not with Google. Yes, I've deployed it to appengine successfully.
> > Your problem may have to do with your JSAPI_KEYS you define in
> > templatelib.py. Is schools.htm coded like index.html in the example
> > code? Make sure you've put in your proper key. Failing that, assuming
> > security issue isn't a concern for you, you could put your key directly
> in
> > your index.html file template script. Note that Google does not recommend
> > putting your jsapi key directly in you template, so it's better to use
> > templatelib.py.
> > In index.html, you could try this:
> > <script type="text/javascript"
> > src="http://www.google.com/jsapi?key=your_key";></script>
> > Again, it's best for security reasons to use templatelib.py for your key.
> > Good Luck!
> >
> > On Wed, Nov 24, 2010 at 11:02 AM, kualoa1 <[email protected]> wrote:
> >>
> >> Thank you.
> >>
> >> 1) Since there was no mention of recreating the geocoded database, I
> >> assumed that it was somehow linked; it clearly already exists.  Can
> >> Google staff confirm ... the database has to be re-created?  (Malcolm,
> >> maybe you are with Google; not clear. :) )   My brief look suggests
> >> this might be a considerable task?  what are the possibilities of
> >> moving the geocoded database to the source files download section?
> >>
> >> -- failing that, does anyone have a small ready to use sample?
> >>
> >> 2) But maybe the database availability is not the entire issue ... in
> >> looking at the downloadable files, I note that many have relative file
> >> coding to '/p/...' and '/hosting ...' folders.  Is there code that
> >> directs this to the correct URL, already embedded in the downloadable
> >> PubSchools files? ... or do all such references need to be re-built?
> >>
> >> Malcolm, have you gone thru the steps to migrate these files and get
> >> PubSchools into operation on an independent server?  I could really
> >> use the help from someone who has done that.
> >>
> >> I really appreciate your help.
> >>
> >> Warren
> >>
> >> On Nov 24, 1:45 pm, Malcolm MacKinnon <[email protected]> wrote:
> >> > Have you geocoded your school addresses in the appengine data store?
> You
> >> > need to do this first, and here's a good tool to
> >> > use:http://code.google.com/p/geopy/<
> http://www.google.com/url?sa=D&q=http://code.google.com/p/geopy/&usg=...>
> >> >
> >> > Read the GettingStarted section.
> >> >
> >> > Using the above tool, you can write a python script to put your lat,
> lng
> >> > values in the datastore .  Read this, and it will show you how.
> >> >
> >> >
> >> > http://pypi.python.org/pypi/geomodel<
> http://www.google.com/url?sa=D&q=http://pypi.python.org/pypi/geomodel...>
> >> >
> >> > I assume your geomodel looks like this:
> >> >
> >> > class PublicSchool(GeoModel):
> >> >   """A location-aware model for public school entities.
> >> >
> >> >   """
> >> >   school_id = db.StringProperty()
> >> >   name = db.StringProperty()
> >> >   address = db.StringProperty()
> >> >   city = db.StringProperty()
> >> >   state = db.StringProperty()
> >> >   zip_code = db.IntegerProperty()
> >> >   enrollment = db.IntegerProperty()
> >> >   phone_number = db.StringProperty()
> >> >   locale_code = db.IntegerProperty()
> >> >   school_type = db.IntegerProperty()
> >> >   school_level = db.IntegerProperty()
> >> >   grades_taught = db.ListProperty(int)
> >> >
> >> > Geocoding the address and putting the values in the datastore will add
> >> > two
> >> > fields to the GeoModel above,
> >> >
> >> > 1) location
> >> > 2) location_geocells
> >> >
> >> > Then, if you query a particular location, like Los Angeles, and you
> have
> >> > put
> >> > public schools with a Los Angeles address in the appengine datastore,
> >> > the
> >> > markers should appear on your map.
> >> >
> >> > I hope this helps.
> >> >
> >> > On Wed, Nov 24, 2010 at 8:47 AM, kualoa1 <[email protected]> wrote:
> >> > > I hope that someone can help me with some basics on getting the
> >> > > pubschools app running on my server.
> >> >
> >> > > 1) I have copied all files as described here
> >> > >
> http://code.google.com/p/geomodel/source/browse/trunk/demos/pubschools
> >> > > to a folder pubschools on my server taking care to get folder
> correct.
> >> >
> >> > > 2) I modified the page displayed whenhttp://
> geomodel-demo.appspot.com/
> >> > > opens to include my API key and saved the file as schools.htm.
> >> >
> >> > > 3) I now point the browser to schools.htm and see only text.
> >> >
> >> > > I am missing something.  but what? any help greatly appreciated.
> >> >
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> > > Groups
> >> > > "Google App Engine" group.
> >> > > To post to this group, send email to
> >> > > [email protected].
> >> > > To unsubscribe from this group, send email to
> >> > >
> >> > > [email protected]<google-appengine%[email protected]>
> <google-appengine%[email protected]<google-appengine%[email protected]>
> >
> >> > > .
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/google-appengine?hl=en.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Google App Engine" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<google-appengine%[email protected]>
> .
> >> For more options, visit this group at
> >> http://groups.google.com/group/google-appengine?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/google-appengine?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en.

Reply via email to