-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
73 lines (46 loc) · 1.6 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from flask import Flask, render_template
from graph import graph_render, serve_graph, post_graph, build_graph, graph_poll
app = Flask(__name__, template_folder='resources/templates')
@app.route('/')
@app.route('/index.html')
def index():
return render_template('index.html')
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/contact')
def contact():
return render_template('contact.html')
@app.route('/links')
def links():
return render_template('links.html')
@app.route('/example')
def example():
return render_template('example.html')
@app.route('/reference')
def reference():
return render_template('reference.html')
@app.route('/graph', methods=['GET'])
def graph_static():
return render_template('graph.html')
@app.route('/graph/images/<graph_id>', methods=['GET'])
def graph_content(graph_id):
return serve_graph(graph_id)
@app.route('/graph/<graph_id>', methods=['GET'])
def graph_view(graph_id):
return graph_render(graph_id)
@app.route('/graph', methods=['POST'])
@app.route('/graph/<graph_id>', methods=['POST'])
def create_graph():
return post_graph()
@app.route('/build_graph', methods=['POST'])
def build():
return build_graph()
@app.route('/poll/<graph_id>', methods=['GET'])
def poll(graph_id):
return graph_poll(graph_id)
if __name__ == '__main__':
# This is used when running locally only. When deploying to Google App
# Engine, a webserver process such as Gunicorn will serve the app. This
# can be configured by adding an `entrypoint` to app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)