Browse files

Add a little more documentation to the demo

  • Loading branch information...
Ben Darnell
Ben Darnell committed Jul 23, 2010
1 parent 673a0d1 commit cf1069f5b2616d957cbae8a912b8ea75dcce89cf
Showing with 19 additions and 4 deletions.
  1. +19 −4 demo/
@@ -1,7 +1,17 @@
#!/usr/bin/env python
-# export PYTHONPATH=.:../tornado:/usr/local/google_appengine:/usr/local/google_appengine/lib/webob
-# $PWD/demo/ --enable_appstats
+'''Demo of appstats tracing.
+Starts a simple server with appstats enabled. Go to http://localhost:8888/
+to generate some sample data, then go to http://localhost:8888/appstats/
+to see the results.
+Requires tornado, tornado_tracing, and the google appengine sdk to be
+on $PYTHONPATH. It also doesn't like it when the app is started using
+a relative path, so run it with something like this:
+ export PYTHONPATH=.:../tornado:/usr/local/google_appengine:/usr/local/google_appengine/lib/webob
+ $PWD/demo/
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
@@ -24,6 +34,9 @@ def get(self):
def handle_timeout(self):
+# A handler that performs several HTTP requests taking different amount of
+# time. It waits for the first request to finish, then issues three requests
+# in parallel.
class RootHandler(recording.RecordingRequestHandler):
def get(self):
@@ -48,10 +61,12 @@ def step2(self, response):
def step3(self):
- self.finish('all done')
+ self.finish('All done. See results <a href="/appstats/">here</a>.')
def main():
+ # doesn't make much sense to run this without appstats enabled
+ options.enable_appstats = True
app = Application([

0 comments on commit cf1069f

Please sign in to comment.