5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-10 03:30:27 +00:00
yggdrasil-map/web/web.py

33 lines
647 B
Python
Raw Normal View History

2014-03-19 09:12:47 +00:00
from flask import Flask, render_template, request
2014-05-28 16:48:46 +00:00
from graphData import insert_graph_data
2014-03-19 09:12:47 +00:00
app = Flask(__name__)
2014-03-30 00:14:02 +00:00
app.debug = False
2014-03-19 09:12:47 +00:00
@app.context_processor
def add_ip():
return dict(ip=request.environ['REMOTE_ADDR'])
@app.route('/')
@app.route('/network')
def page_network():
2014-05-13 22:36:55 +00:00
return render_template('network.html', page='network')
@app.route('/about')
def page_about():
return render_template('about.html', page='about')
2014-03-19 09:12:47 +00:00
2014-05-28 16:48:46 +00:00
@app.route('/sendGraph', methods=['POST'])
def page_sendGraph():
data = request.form['data']
ret = insert_graph_data(data)
if ret:
return 'OK'
else:
return 'FAIL'
2014-03-19 09:12:47 +00:00
if __name__ == '__main__':
app.run(host='::')