Skip to content

Instantly share code, notes, and snippets.

@crawftv
Last active April 25, 2019 02:52
Show Gist options
  • Save crawftv/0917d0396eb45e637859ded469c46adc to your computer and use it in GitHub Desktop.
Save crawftv/0917d0396eb45e637859ded469c46adc to your computer and use it in GitHub Desktop.
Javascript, jinja tutorial
#The important imports for this tutorial
from flask import Flask, render_template, json
#Skiping a whole lot of the file to get to the useful parts.
"""Focusing on just this route that display a linechart for the sentiment of a topic over time."""
@app.route('/line', methods =["GET"])
def line_chart():
"""
Doing a bunch of python
Using a small example data set.
"""
data = json.dumps( [1.0,2.0,3.0] )
labels=json.dumps( ["12-31-18", "01-01-19", "01-02-19"] )
return render_template("linechart.html", data = data,
labels=labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment