예제 #1
0
    # Get top 9 user ids
    top_active_user_ids = db.session\
            .query(model.TaskRun.user_id,
                    func.count(model.TaskRun.id).label('total'))\
            .group_by(model.TaskRun.user_id)\
            .order_by('total DESC')\
            .limit(10)\
            .all()
    top_users = []
    for id in top_active_user_ids:
        if id[0] is not None:
            u = db.session.query(model.User).get(id[0])
            tmp = dict(user=u, apps=[])
            top_users.append(tmp)
    d = {'featured': featured, 'top_apps': top_apps, 'top_users': top_users}

    return render_template('/home/index.html', **d)


@app.route("/about")
def about():
    """Render the about template"""
    return render_template("/home/about.html")


if __name__ == "__main__":
    logging.basicConfig(level=logging.NOTSET)
    app.run(host=app.config['HOST'],
            port=app.config['PORT'],
            debug=app.config.get('DEBUG', True))
예제 #2
0
            .all()
    top_users = []
    for id in top_active_user_ids:
        if id[0] is not None:
            u = db.session.query(model.User).get(id[0])
            tmp = dict(user=u, apps=[])
            top_users.append(tmp)
    d = {
        'featured': featured,
        'top_apps': top_apps,
        'top_users': top_users
    }

    return render_template('/home/index.html', **d)


@app.route("/about")
def about():
    """Render the about template"""
    return render_template("/home/about.html")

@app.route("/search")
def search():
    """Render search results page"""
    return render_template("/home/search.html")

if __name__ == "__main__":
    logging.basicConfig(level=logging.NOTSET)
    app.run(host=app.config['HOST'], port=app.config['PORT'],
            debug=app.config.get('DEBUG', True))
예제 #3
0
파일: web.py 프로젝트: hsenot/pybossa
        if current_user.admin:
            d["top_users"] = cached_users.get_top()
    if not app.config["ENFORCE_PRIVACY"]:
        d["top_users"] = cached_users.get_top()
    return render_template("/home/index.html", **d)


@app.route("/about")
def about():
    """Render the about template"""
    return render_template("/home/about.html")


@app.route("/search")
def search():
    """Render search results page"""
    return render_template("/home/search.html")


def get_port():
    port = os.environ.get("PORT", "")
    if port.isdigit():
        return int(port)
    else:
        return app.config["PORT"]


if __name__ == "__main__":
    logging.basicConfig(level=logging.NOTSET)
    app.run(host=app.config["HOST"], port=get_port(), debug=app.config.get("DEBUG", True))