def _ping_dev(): url = '%sview/%s/%s/' % ( config['tunnel_url'], config['username'], app_slug, ) while 1: remote_call(config, 'start_dev', app_slug=app_slug, url=url, toolbar=namespace.toolbar, ) time.sleep(240) # Wait 4 Minutes
def handle(namespace, extra): APP_PARSER.add_argument('-t', '--no-toolbar', dest='toolbar', action='store_false', default=True) namespace = APP_PARSER.parse_args() dirname = os.path.abspath(os.path.expanduser(namespace.directory)) app_slug = get_app_slug(namespace) config = get_config(namespace) def _ping_dev(): url = '%sview/%s/%s/' % ( config['tunnel_url'], config['username'], app_slug, ) while 1: remote_call(config, 'start_dev', app_slug=app_slug, url=url, toolbar=namespace.toolbar, ) time.sleep(240) # Wait 4 Minutes ping_dev_thread = threading.Thread(target=_ping_dev) ping_dev_thread.daemon = True ping_dev_thread.start() func = create_monitor_thread(config, dirname, app_slug=app_slug) watch_change_thread = threading.Thread(target=func) watch_change_thread.daemon = True watch_change_thread.start() try: print 'Starting up development server' serve(config, dirname, app_slug) except KeyboardInterrupt: print '\nTearing down development server' remote_call(config, 'stop_dev', app_slug=app_slug)