def main(): parser = argparse.ArgumentParser( prog='june', description='June: a forum', ) parser.add_argument('command', nargs="*") parser.add_argument('-f', '--config', dest='config') args = parser.parse_args() if args.config: parse_config_file(args.config) # config else: return init_project() def run_command(cmd): if cmd == 'createdb': return create_db() if cmd == 'createuser': return create_superuser() if cmd == 'init': return init_project() if isinstance(args.command, basestring): return run_command(args.command) if isinstance(args.command, (list, tuple)): for cmd in args.command: run_command(cmd)
def run_server(): define('settings', '') tornado.options.parse_command_line() parse_config_file(options.settings) server = HTTPServer(Application(), xheaders=True) server.listen(int(options.port)) IOLoop.instance().start()
def run_server(): define('config', '') define('port', '8000') tornado.options.parse_command_line() parse_config_file(options.config) server = HTTPServer(Application(), xheaders=True) server.bind(int(options.port)) server.start(int(options.num_processes)) IOLoop.instance().start()