Example #1
0
File: app.py Project: g4he/g4he

@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404

@app.errorhandler(401)
def page_not_found(e):
    return render_template('401.html'), 401
        
        
@app.route('/')
def index():

    #logofolder = os.path.dirname(os.path.abspath( __file__ )) + '/static/logos'
    #logos=sorted(os.listdir(logofolder))
    logos = []

    return render_template(
        'index.html',
        logos=logos,
        orgs=json.dumps(dropdowns('record','collaboratorOrganisation.canonical'))
    )

    return render_template('index.html')
    

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=app.config['DEBUG'], port=app.config['PORT'])

Example #2
0
from flask import Flask, request, abort, render_template, redirect, make_response, jsonify, send_file, \
    send_from_directory
from flask.views import View

import portality.models as models
from portality.core import app
from portality import settings

from portality.view.query import blueprint as query
app.register_blueprint(query, url_prefix='/user_query')

@app.route("/")
def root():
    return render_template("app/search.html")

@app.errorhandler(404)
def page_not_found(e):
    return render_template('errors/404.html'), 404


if __name__ == "__main__":
    app.run(host=app.config.get("HOST", "0.0.0.0"), debug=app.config['DEBUG'], port=app.config['PORT'])

Example #3
0
        })


@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404


@app.errorhandler(401)
def page_not_found(e):
    return render_template('401.html'), 401


if __name__ == "__main__":
    pycharm_debug = app.config.get('DEBUG_PYCHARM', False)
    if len(sys.argv) > 1:
        if sys.argv[1] == '-d':
            pycharm_debug = True

    if pycharm_debug:
        app.config['DEBUG'] = False
        import pydevd
        pydevd.settrace(app.config.get('DEBUG_PYCHARM_SERVER', 'localhost'),
                        port=app.config.get('DEBUG_PYCHARM_PORT', 6000),
                        stdoutToServer=True,
                        stderrToServer=True)

    app.run(host=app.config['HOST'],
            debug=app.config['DEBUG'],
            port=app.config['PORT'])
Example #4
0
            abort(404)
        elif util.request_wants_json():
            resp = make_response(record.json)
            resp.mimetype = "application/json"
            return resp
        else:
            return render_template('catalogue.html', record=record)
    else:
        return render_template('catalogue.html')


@app.route('/fact')
@app.route('/fact/<rid>')
def fact(rid=False):
    if rid:
        record = models.Fact.pull(rid.replace('.json', ''))
        if record is None:
            abort(404)
        elif util.request_wants_json():
            resp = make_response(record.json)
            resp.mimetype = "application/json"
            return resp
        else:
            return render_template('fact.html', record=record)
    else:
        return render_template('fact.html')


if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=app.config['DEBUG'], port=app.config['PORT'])
Example #5
0
    elif "api_key" in request.values:
        res = models.Account.query(q='api_key:"' + request.values["api_key"] + '"')["hits"]["hits"]
        if len(res) == 1:
            user = models.Account.pull(res[0]["_source"]["id"])
            if user:
                login_user(user, remember=False)


@app.errorhandler(404)
def page_not_found(e):
    return render_template("404.html"), 404


@app.errorhandler(401)
def page_not_found(e):
    return render_template("401.html"), 401


@app.route("/")
def default():
    return render_template("swap/index.html")


@app.route("/policy")
def policy():
    return render_template("swap/policy.html")


if __name__ == "__main__":
    app.run(host="0.0.0.0", debug=app.config["DEBUG"], port=app.config["PORT"])