Google visualization api on application engine not working ... (python)

I am trying to display a sorted table presented in the Google visualization API in my application within the application, but it does not work. The application is written in python and uses the django framework.

When I copy the generated HTML / Javascript and save it as a regular html file locally, it works fine. This makes me think that the problem is that http://www.google.com/jsapi '> is not part of or cannot work.

Anyone else come across this? Am I missing part of the configuration in app.yaml?

Thanks!

EDIT: This is where the HTML is created:

<!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"> <head> <title> Test </title> <link href="/css/css.css" rel="stylesheet" type="text/css" /> <script type='text/javascript' src='http://www.google.com/jsapi'></script> <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 great when saving 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 
-1
source share
2 answers

If anyone else has this problem, I messed up the page headers generated by the rendering with the same function that I created for XML output.

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

0
source

Wait, where are you rendering? Visapi material goes on the client side. Where is it from you? (Sorry, if this is obvious, it is really not entirely clear from how you wrote the question.)

More details will definitely help.

0
source

Source: https://habr.com/ru/post/1302550/


All Articles