def cmd_debug(self, *args): """ Comando 'debug', responsável por iniciar o servidor de desenvolvimento. """ port = int(args[0]) if args else self.port ServerLog.info(code='dev_server_starting', args=[port]) app = Application(routers, debug=True, autoreload=False, cookie_secret=config('SECRET_KEY'), login_url='/api/v1/usuarios/entrar/', xsrf_cookies=False) app.listen(port) r.set_loop_type('tornado') ioloop = IOLoop.current() ioloop.add_callback( callback=ServerLog.info, code='server_started', args=[self.host, port] ) ioloop.start()
def cmd_serve(self, *args): """ Comando 'serve', responsável por iniciar o servidor de produção. """ port = int(args[0]) if args else self.port ServerLog.info(code='dev_server_starting', args=[port]) app = Application( routers, cookie_secret=config('SECRET_KEY'), login_url='/api/v1/usuarios/entrar/', xsrf_cookies=False) sockets = netutil.bind_sockets(port) process.fork_processes(self.fork_processes) server = HTTPServer(app) server.add_sockets(sockets) r.set_loop_type('tornado') ioloop = IOLoop.current() ioloop.add_callback( callback=ServerLog.info, code='server_started', args=[self.host, port] ) ioloop.start()