开发者

how to call python code in javascript to display bar chart

开发者_如何学C

i have written python code which gives me i/p to chart(json data) but i am not getting how to get these data in my javascript.

i want to display it in google app engine

i want to do it in same way as we can do it with PHP.


Have you tried the Google charts API?


As I've posted a few times already, if you want Python to be PHP-like, try Flask

Flask is dead-simple, extremely powerful, and intuitive. I prefer it over PHP for soo many reasons, but mainly because PHP is not Python.

Here's what I mean by simple and intuitive. I can't really explain it in words, so here's an example script:

File: script.py

app = Flask(__name__)
app.config.from_object(__name__)

@app.route('/')
def index():
  return render_template('index.html', message = range(0, 10000))

if __name__ == '__main__':
  app.run(host = '0.0.0.0')

File: index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
  <head>
    <title>Test</title>
  </head>

  <body>
  {% for hello in message %}
    <p>{{ hello }}</p>
  {% endif %}
  </body>
</html>

I'm pretty sure it's usable with Google App Engine, but please correct me if I'm wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜