Created
April 7, 2011 17:03
-
-
Save peterbe/908208 to your computer and use it in GitHub Desktop.
Starting tornado with preforking (multiple threads, one port)
This file contains 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
def main(): # pragma: no cover | |
tornado.options.parse_command_line() | |
if options.showurls: | |
for path, class_ in route.get_routes(): | |
print path | |
return | |
http_server = tornado.httpserver.HTTPServer(Application()) | |
print "Starting tornado on port", options.port | |
if options.prefork: | |
print "\tpre-forking" | |
http_server.bind(options.port) | |
http_server.start() | |
else: | |
http_server.listen(options.port) | |
try: | |
tornado.ioloop.IOLoop.instance().start() | |
except KeyboardInterrupt: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment