Ejemplo n.º 1
0
def add_flask_profiler(flask_app):
    # https://github.com/muatik/flask-profiler
    from flask_profiler import Profiler
    # You need to declare necessary configuration to initialize
    # flask-profiler as follows:
    flask_app.config["flask_profiler"] = {
        "enabled": True,
        "storage": {
            "engine": "sqlite"
        },
        "basicAuth": {
            "enabled": True,
            "username": "******",
            "password": "******"
        },
        "ignore": ["^/static/.*"]
    }

    profiler = Profiler()
    profiler.init_app(flask_app)
Ejemplo n.º 2
0
        "^/static/.*",
    ],
    "endpointRoot": "metrics"
}


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/version')
def version():
    return 'v2.0.1'


@app.route('/readiness')
def readiness():
    return 'OK'


@app.route('/healthz')
def healthz():
    return 'OK'


profile.init_app(app)

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')
Ejemplo n.º 3
0
profiler = Profiler()

app = Flask(__name__)
app.config['DEBUG'] = True
app.config['flask_profiler'] = {
    "enabled" : app.config['DEBUG'],
    "storage" : {
        "engine" : "sqlite"
    },
    "basicAuth" : {
        "enabled" : True,
        "username" : "admin",
        "password" : "admin"
    }
}

profiler.init_app(app)


@app.route("/")
def index():
    return "Welcome to profiling!"


@app.route("/user/<name>")
def users(name):
    return f"The specified user is: {name}"

if __name__ == "__main__":
    app.run('0.0.0.0', debug= True)