Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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