Last active
December 10, 2015 01:58
-
-
Save wolf0403/4363542 to your computer and use it in GitHub Desktop.
Tornado test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import tornado.ioloop | |
import tornado.web | |
import tornado.process | |
import tornado.netutil | |
from tornado.httpserver import HTTPServer | |
import time | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self, *args): | |
self.set_header ('Content-Type', 'text/plain') | |
#time.sleep (0.1) | |
self.write("tornado sleep (0.1)") | |
self.write (str (args)) | |
application = tornado.web.Application([ | |
(r"/(.*)", MainHandler), | |
], debug=False) | |
if __name__ == "__main__": | |
server = HTTPServer (application) | |
server.bind (9000) | |
server.start (2) # force two worker processes | |
tornado.ioloop.IOLoop.instance().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment