forked from softwareunderground/careermap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
41 lines (31 loc) · 837 Bytes
/
app.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
# -*- coding: utf-8 -*-
from flask import Flask, request, render_template
import utils
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
"""
Serve the form.
"""
if request.method == 'POST':
data = request.form.get('data')
_ = utils.store_entry(data) # Persist.
path = utils.get_path(data)
result = utils.store_path(path)
else:
result = ''
return render_template('form.html', result=result)
@app.route('/plot', methods=["GET"])
def plot():
"""
Serve a plot of the network.
"""
G = utils.get_network()
result = {'plot': utils.plot(G)}
return render_template('plot.html', result=result)
@app.route('/about', methods=['GET'])
def about():
"""
Serve the page.
"""
return render_template('about.html')