Flask-Perf-0.1.6
توضیحات
A simple profiler for flask applications.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | Flask-Perf-0.1.6 |
| نام | Flask-Perf |
| نسخه کتابخانه | 0.1.6 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Andrei Betlen |
| ایمیل نویسنده | abetlen@gmail.com |
| آدرس صفحه اصلی | https://github.com/abetlen/Flask-Perf |
| آدرس اینترنتی | https://pypi.org/project/Flask-Perf/ |
| مجوز | MIT |
# Flask-Perf
[](https://badge.fury.io/py/Flask-Perf)
[](https://travis-ci.org/abetlen/Flask-Perf)
[](https://coveralls.io/github/abetlen/Flask-Perf?branch=master)
A simple Flask extension for profiling your application code and database queries.
## Installation
```bash
$ pip install flask_perf
```
## Example
```python
from flask import Flask, jsonify
from flask_perf import Profiler
app = Flask(__name__)
app.config["PROFILER_ENABLED"] = True
profiler = Profiler(app) # or profiler.init_app(app)
@app.route("/")
def index():
return jsonfiy({
"message": "Hello World!"
})
```
## Configuration
| Config Name | Description | `default` |
| :---------- |:------------| -------:|
| `PROFILER_ENABLED` | Enable the profiler. | `False` |
| `PROFILER_RESTRICTIONS` | List of profiler restrictions, described in depth in the [Official Python Docs](https://docs.python.org/dev/library/profile.html#pstats.Stats.print_stats) | `[]` |
| `PROFILER_SQLALCHEMY_ENABLED` | Enable SQLAlchemy query logging. **Note**: This option requires that the `flask_sqlalchemy` package is installed and the `SQLALCHEMY_RECORD_QUERIES` config option is set to `True`. | `False` |
| `PROFILER_SQLALCHEMY_THRESHOLD` | Minimum query duration in seconds to log. | `0` |
| `PROFILER_SQLALCHEMY_FORMAT` | Logged SQLAlchemy query format. See the [Flask-SQLAlchemy docs](http://flask-sqlalchemy.pocoo.org/2.3/api/#flask_sqlalchemy.get_debug_queries) for a list of attributes you can use in this format string. | `"\n\n{duration:1.2e}s\n\n{statement}\n"` |
## Links
- [Blog Post that inspired this package.](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling)
نیازمندی
| مقدار | نام |
|---|---|
| - | Flask |
| xtr | flask-sqlalchemy; |
نحوه نصب
نصب پکیج whl Flask-Perf-0.1.6:
pip install Flask-Perf-0.1.6.whl
نصب پکیج tar.gz Flask-Perf-0.1.6:
pip install Flask-Perf-0.1.6.tar.gz