Appstats and Bottle on GAE
Google app engine apps are fairly easy to profile, thanks to the Appstats library. I’ll show you here how to configure the Appstats for use with your bottle app here.
First you need to enable the appstats built-in component in the builtins: section in app.yaml:
builtins:
....
- appstats: on
You will also need a login handler, as discussed in the previous post.
Finally, you need to add the appstats wsgi middleware to your bottle app. Here’s how to do it:
if __name__ == '__main__':
from google.appengine.ext.appstats import recording
....
app = bottle.app()
stats_app = recording.appstats_wsgi_middleware(app)
run(app=stats_app, server='gae')
After you start the development server (or deploy the application), you will see the stats when you hit localhost:8080/_ah/stats/ (or yourapp.appspot.com/_ah/stats). I won’t go into details as to what you’ll find there. It’s pretty self-explanatory.




