Skip to content

Instantly share code, notes, and snippets.

@cjgiridhar
Created August 28, 2012 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjgiridhar/3500990 to your computer and use it in GitHub Desktop.
Save cjgiridhar/3500990 to your computer and use it in GitHub Desktop.
Tornado - AutoReload
import tornado.web
import tornado.autoreload
class Main(tornado.web.RequestHandler):
def get(self):
self.write("Main")
application = tornado.web.Application([
(r"/", Main)
])
if __name__ == '__main__':
def fn():
print "Hooked before reloading..."
application.listen(8000)
tornado.autoreload.add_reload_hook(fn)
tornado.autoreload.start()
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment