コード例 #1
0
ファイル: views.py プロジェクト: sonikandpikachu/wc_work
    # mail.save_feedback(request.args['msg'], request.args['email'])
    resp = jsonify({"Send": "true"})
    resp.status_code = 200
    return resp


@app.route("/tooltip/<key>/")
def tooltip(key):
    return render_template_string(TOOLTIPS_DICT[key])


@app.route("/gallery/<type>/<id>/")
def gallery(type, id):
    dir = os.path.join(os.path.dirname(__file__), "static/img/" + type + "s/" + id + "_img")
    names = os.listdir(dir)  # список файлов и поддиректорий в данной директории
    if len(names) != 1:
        names.remove("main.jpg")
    return render_template("gallery.html", images=names, type=type, id=id)


if __name__ == "__main__":
    # app.run(host = '192.168.1.100', port = 80)
    # port = int(os.environ.get('PORT', 5000))
    # app.run(host='0.0.0.0', port=port)
    app.run(debug=True)
    # controller = SQLController()
    # session = controller.create_sql_session()
    # components =  wc_RAM, wc_HD, wc_CPU, wc_OS, wc_ODD, wc_Screen, wc_Type, wc_Chipset
    # query = session.query(wc_Computer).join(*components)
    # print query.filter('wc_HD.id = 1 and wc_CPU.id > 2').all()
コード例 #2
0
            if cut:
                cut_values.append(cut)
    print 'cut_values', cut_values, 'dss_values', dss_values
    print dbwrapper.sorted_devices_id(cut_values, dss_values)
    return dbwrapper.sorted_devices_id(cut_values, dss_values)


@app.route('/computer/<id>/')
def third_computer(id):
    dbwrapper = db_queries.DBWrapper(session['type'])
    concdevices = dbwrapper.concdevices_by_device_id(id)
    big_pretty_comp = pretty_data.big_computer(id, dbwrapper)
    small_pretty_comp = pretty_data.small_devices([id], [0], dbwrapper)[0]
    return render_template('Comp.html', big_comp=big_pretty_comp,
                                small_comp=small_pretty_comp,
                                conccomps=concdevices)


if __name__ == '__main__':
    #app.run(host = '192.168.1.100', port = 80)
    port = int(os.environ.get('PORT', 5000))
    app.run(debug=True, host='0.0.0.0', port=port)
    # print FILTERS[u'computer']
    # print FILTERS[u'notebook']
    # print FILTERS[u'all']
    # controller = SQLController()
    # session = controller.create_sql_session()
    # components =  wc_RAM, wc_HD, wc_CPU, wc_OS, wc_ODD, wc_Screen, wc_Type, wc_Chipset
    # query = session.query(wc_Computer).join(*components)
    # print query.filter('wc_HD.id = 1 and wc_CPU.id > 2').all()
コード例 #3
0
ファイル: views.py プロジェクト: sonikandpikachu/wc_work
    resp = jsonify({"Send": "true"})
    resp.status_code = 200
    return resp


@app.route('/tooltip/<key>/')
def tooltip(key):
    return render_template_string(TOOLTIPS_DICT[key])


@app.route('/gallery/<type>/<id>/')
def gallery(type, id):
    dir = os.path.join(os.path.dirname(__file__),
                       'static/img/' + type + 's/' + id + "_img")
    names = os.listdir(
        dir)  # список файлов и поддиректорий в данной директории
    if len(names) != 1: names.remove('main.jpg')
    return render_template('gallery.html', images=names, type=type, id=id)


if __name__ == '__main__':
    #app.run(host = '192.168.1.100', port = 80)
    #port = int(os.environ.get('PORT', 5000))
    #app.run(host='0.0.0.0', port=port)
    app.run(debug=True)
    # controller = SQLController()
    # session = controller.create_sql_session()
    # components =  wc_RAM, wc_HD, wc_CPU, wc_OS, wc_ODD, wc_Screen, wc_Type, wc_Chipset
    # query = session.query(wc_Computer).join(*components)
    # print query.filter('wc_HD.id = 1 and wc_CPU.id > 2').all()