views:

375

answers:

2

I'm trying to render the sortable table that's provided in Google visualization API in my app on app engine, but it's not working. The app is written in python and uses the django framework.

When I copy the generated HTML/Javascript and save it as a plain html file locally, it works just fine. This leads me to believe that the problem is that is not getting included or is not able to run.

Anyone else run into this? Am I missing some configuration piece in app.yaml?

Thanks!

EDIT: Here's the HTML that is being produced:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"&gt; 
 <head>
   <title> 
      Test
   </title> 
   <link href="/css/css.css" rel="stylesheet" type="text/css" /> 
    <script type='text/javascript' src='http://www.google.com/jsapi'&gt;&lt;/script&gt; 
    <script type='text/javascript'> 
      google.load('visualization', '1', {packages:['table']});
      google.setOnLoadCallback(drawTable);
      function drawTable() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Number');
        data.addColumn('string', 'Status');
    data.addColumn('string', 'Nickname');
        data.addColumn('string', 'Target');
    data.addColumn('string', 'Recording');
        data.addRows(2);

        data.setCell(0, 0, '0987654321');

    data.setCell(0, 1, 'Active');

        data.setCell(0, 2, 'Nothing');
        data.setCell(0, 3, '1234567890');

    data.setCell(0, 4, 'Enabled');

    data.setCell(1, 0, '0987654321');

    data.setCell(1, 1, 'Active');

        data.setCell(1, 2, 'Nothing');
        data.setCell(1, 3, '1234567890');

    data.setCell(1, 4, 'Enabled');


       var table = new google.visualization.Table(document.getElementById('table_div'));
       table.draw(data, {showRowNumber: true});
      }
    </script> 
 </head> 
 <body> 
    <div id='table_div'></div> 
 </body> 
</html> 

This works fine if saved as an html file.

app.yaml:

application: testapp
version: 2
runtime: python
api_version: 1

handlers:
- url: /(.*\.(mp3|wav))
  static_files: \1
  upload: (.*\.(mp3|wav))

- url: /css
  static_dir: css

- url: /.*
  script: main.py
A: 

Wait, where are you doing the rendering? The visapi stuff goes in the client-side. Is that where you have it? (Sorry if that's obvious; it's really not entirely clear from the way you wrote the question.)

More details would definitely help.

LH
Thank you, and yeah, it's in the client-side.I've posted the html and the app.yaml. I'm 99% sure that the issue is with either app.yaml or with including a remote javascript.
Sologoub
I never had to do *anything* to app.yaml to get these to work. FWIW.
LH
Ah, and now I've had a chance to look at your generated code. Your problem is your code. I think you're confusing "works on the generated html" for "works by accident when exactly the right things happen in the right order." If you fix that, it'll work from the appengine, too.
LH
LH, sorry for noobishness, but can you elaborate?
Sologoub
A: 

In case anyone else has this issue - I messed up headers of the page generated by rendering with the same function I created for XML output.

Including this killed it: handler.response.headers["Content-Type"] = "text/xml"

Sologoub