Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flask-profiler work in production mode? #38

Closed
havok2063 opened this issue Jun 9, 2016 · 4 comments
Closed

flask-profiler work in production mode? #38

havok2063 opened this issue Jun 9, 2016 · 4 comments
Labels

Comments

@havok2063
Copy link

Does the flask-profiler only work in debug mode? While this is great for debugging, I'd like to collect statistics while users are navigating my Flask app in a real production environment. Is this possible? If so, can you provide an example of the config info that needs to be set?

@muatik muatik added the question label Jun 9, 2016
@muatik
Copy link
Owner

muatik commented Jun 9, 2016

It can work regardless of what the debug mode is. Please have a look at quick start examples: https://github.com/muatik/flask-profiler#quick-start

You can turn on/off it using the enabled directive as follows.

If debug mode is on, then the flask profiler is on.

app.config["flask_profiler"] = {
    "enabled": app.config["DEBUG"]
}

Flask-profiler is always on:

app.config["flask_profiler"] = {
    "enabled": True
}

@muatik
Copy link
Owner

muatik commented Jun 9, 2016

and if you want to use it in a production environment, do not forget to turn basic authentication on so that only people know username and password can access to flask-profiler.

app.config["flask_profiler"] = {
    "enabled": True
    "basicAuth":{
        "enabled": True,
        "username": "admin",
        "password": "admin"
    }
}

@havok2063
Copy link
Author

Ok. That makes sense. I did read the quickstart, but it wasn't clear about debug vs production. And I only say

    app.config["flask_profiler"] = {
        "enabled": app.config["DEBUG"],
    }

@divyenduz
Copy link
Contributor

divyenduz commented Oct 22, 2016

The next release will also have a feature to do sampling in production, making flask-profiler lean and more useful for production workloads. Refer to #44 for details.

@muatik : I think this issue can also be closed.

@muatik muatik closed this as completed Oct 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants