Skip to content

Instantly share code, notes, and snippets.

@qiao-meng-zefr
qiao-meng-zefr / flask_profiler.py
Created June 22, 2018 21:34 — forked from shreyansb/flask_profiler.py
A profiler for Flask apps
"""
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the profile or cProfile
module to do the profiling and writes the stats to the stream provided
To use, run `flask_profiler.py` instead of `app.py`
see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/
and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling
"""
Please bear in mind this is for a Debian environment - specifically Jessie so directive in apache
vhost will differ if you're not using apache-2.4.
I followed the instructions for the development environment (N.B. DO NOT use `test` as the account
for `createsuperuser` as this will break `loaddate test_data`):
sudo mkdir /usr/share/readthedocs
sudo chown your_username readthedocs
sudo apt-get install build-essential python-dev libxml2-dev libxslt1-dev zlib1g-dev virtualenv git
cd /usr/share/