annot-server/webapp/views.py
author ymh <ymh.work@gmail.com>
Tue, 14 Oct 2014 05:07:37 +0200
changeset 22 986ee928a866
child 28 6025b8470d18
permissions -rw-r--r--
add sqlalchemy model + put create module for webapp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
#
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
# See LICENCE for detail
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
# Copyright (c) 2014 IRI
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
#
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
from flask import render_template, jsonify, request
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
from webapp import app
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
@app.route('/')
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
def page_home():
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    return render_template('index.html')
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    #return render_template('annotationclient.html', logging=True)
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
@app.route('/annot')
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
def page_annot():
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    return render_template('annot.html')
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
@app.route('/annotationclient')
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
def page_annotationclient():
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
    return render_template('annotationclient.html', logging=True)
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
@app.route('/api/test', methods=['PUT', 'POST'])
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
def new():
986ee928a866 add sqlalchemy model + put create module for webapp
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
    return jsonify(request.get_json(force=False))