def run(self): http_server = httpserver.HTTPServer(application) http_server.listen(options.port) # https_server = httpserver.HTTPServer(application, ssl_options={ # "certfile": rel("server.crt"), # "keyfile": rel("server.key"), # }) # https_server.listen(options.ssl_port) ioloop = tornado.ioloop.IOLoop.instance() ioloop.start() daemon = HTTPDaemon(rel('daemons', 'http-debugger.pid'), stdout=rel('daemons', 'http-debugger.log'), stderr=rel('daemons', 'http-debugger.err')) if len(sys.argv) >= 2: if 'start' == sys.argv[len(sys.argv)-1]: daemon.start() elif 'stop' == sys.argv[len(sys.argv)-1]: daemon.stop() elif 'restart' == sys.argv[len(sys.argv)-1]: daemon.restart() elif 'status' == sys.argv[len(sys.argv)-1]: daemon.status() else: sys.exit(2) sys.exit(0)
# -*- coding: utf-8 -*- """ httphq.debug ~~~~~~~~~~~~ Local debug runner :copyright: (c) 2011 by Alexandr Sokolovskiy ([email protected]). :license: BSD, see LICENSE for more details. """ import tornado.ioloop from tornado import httpserver, autoreload from tornado.options import options, parse_command_line from app import application, rel if __name__ == '__main__': parse_command_line() http_server = httpserver.HTTPServer(application) https_server = httpserver.HTTPServer(application, ssl_options={ "certfile": rel("server.crt"), "keyfile": rel("server.key"), }) http_server.listen(options.port) https_server.listen(options.ssl_port) ioloop = tornado.ioloop.IOLoop.instance() autoreload.start(io_loop=ioloop, check_time=100) ioloop.start()