Exemplo n.º 1
0
def bootstrap(debug=False, debug_db=False, latency=None, log_level=None):
    """ Bootstrap the Flask application and return a reference to it. """

    global flask_app

    if flask_app is not None:
        raise RuntimeError("The application should not be"
                           " bootstrapped more than once.")

    # Initialize Flask.
    flask_app = MyFlask(
        __name__,
        static_folder=app.config.get_path("static"),
        template_folder=app.config.get_path("lib/app/templates")
    )

    flask_app.debug = debug
    flask_app.debug_db = debug_db
    flask_app.latency = latency

    config = app.config.get_config()

    if log_level is not None:
        config.set('logging', 'log_level', log_level)

    # Run the bootstrap.
    init_logging(flask_app, config)
    init_flask(flask_app, config)
    init_errors(flask_app, config)
    init_webassets(flask_app, config)
    init_views(flask_app, config)

    return flask_app
Exemplo n.º 2
0
def bootstrap(debug=False, debug_db=False, latency=None, log_level=None):
    """ Bootstrap the Flask application and return a reference to it. """

    global flask_app

    if flask_app is not None:
        raise RuntimeError("The application should not be" \
                           " bootstrapped more than once.")

    # Initialize Flask.
    flask_app = MyFlask(
        __name__,
        static_folder=app.config.get_path("static"),
        template_folder=app.config.get_path("lib/app/templates")
    )

    flask_app.debug = debug
    flask_app.debug_db = debug_db
    flask_app.latency = latency

    config = app.config.get_config()

    if log_level is not None:
        config.set('logging', 'log_level', log_level)

    # Run the bootstrap.
    init_logging(flask_app, config)
    init_flask(flask_app, config)
    init_errors(flask_app, config)
    init_webassets(flask_app, config)
    init_views(flask_app, config)

    return flask_app
Exemplo n.º 3
0
def license_post(request):
    #检查HTTP POST表单
    if request.form['license'] == "accepted":
        #更改设定
        config.set("License", "License", "True")
        #写入设定
        config.write(open('config.ini', 'w'))
    #返回完成信息
    return "Done"
Exemplo n.º 4
0
 def func(i):
     if old[i][1] != changelist[i].capitalize():
         #修改设置
         config.set(key, old[i][0], changelist[i].capitalize())
         #保存到设置文件
         config.write(open('config.ini', 'w'))