diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2014-05-28 14:11:24 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2014-05-28 14:11:24 +0300 |
| commit | 47762976ab1048b227c45fb2359c31c748b45fa1 (patch) | |
| tree | 1afc0d3affe98c2429df99350602809ea4774fae /server.py | |
| parent | 5c27b257eea9a9c8f5a70f5ffc9c2a290626f001 (diff) | |
GET and POST data
Diffstat (limited to 'server.py')
| -rw-r--r-- | server.py | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1,12 +1,22 @@ from flask import Flask -from flask import render_template -app = Flask(__name__) +from flask import render_template, request +from unipath import FSPath as Path + +DATA_DIR = Path(__file__).absolute().child('data') +app = Flask(__name__) @app.route('/') def home(): return render_template('home.html') +@app.route('/data', methods=['POST', 'GET']) +def data(): + if request.method == 'GET': + return 'hai' + elif request.method == 'POST': + print request.json + return 'ok' -if __name__ == "__main__": - app.run() +if __name__ == '__main__': + app.run(debug=True) |
