def main(): app = Application([('/', home_handler, render_basic)]) meta_app = meta_service.create_meta_app() wsgi_apps = [(app, ('0.0.0.0', PORT), False), (meta_app, ('0.0.0.0', META_PORT), False)] if platform.system() == 'Windows': group = Group(wsgi_apps=wsgi_apps) else: group = Group(wsgi_apps=wsgi_apps, prefork=True, num_workers=2, daemonize=True) group.serve_forever()
def main(): prs = argparse.ArgumentParser() prs.add_argument('--debug', action='store_true') opts, _ = prs.parse_known_args() debug = opts.debug v1_app = create_v1_app() app = Application([('/v1', v1_app)]) meta_app = MetaApplication() if debug: app.add(('/', meta_app)) app.serve(port=PORT) else: group = Group(wsgi_apps=[(app, ('0.0.0.0', PORT), False), (meta_app, ('0.0.0.0', META_PORT), False)], num_workers=1, prefork=True, daemonize=True) group.serve_forever()