The extension is available at PyPI and can be installed with the pip command:
$ pip install Flask-GAE-Mini-Profiler
As package management with Google App Engine can be tricky, it’s recommended to keep your libraries in a seperate folder.
myapp/ lib/ flask/ flaskext/ __init__.py gae_mini_profiler/
The __init__.py must contain the following line to declare the folder a namespace:
Now all you got to do is make sure that your lib folder is added to the Python library path before any packages are imported. Add a snippet like this before your imports:
import os import sys PACKAGE_DIR = os.path.join( os.path.dirname(__file__), "lib" ) sys.path.insert(0, PACKAGE_DIR)
Flask-GAE-Mini-Profiler is very easy to use:
from flask import Flask from flaskext.gae_mini_profiler import GAEMiniProfiler app = Flask(__name__) GAEMiniProfiler(app)
That’s it. Enjoy your profiling stats.