def run(self): from google.appengine.tools import appcfg from kay.management.preparse import do_preparse_apps import sys old_stdout = sys.stdout old_stderr = sys.stderr redir = RedirectText(self.win) sys.stdout = redir sys.stderr = redir import time do_preparse_apps() args = ['manage.py', 'update', os.getcwdu()] try: app = appcfg.AppCfgApp(args, raw_input_fn=self.ask_username, password_input_fn=self.ask_pass, error_fh=redir) result = app.Run() if result: print_status('Failed Deploying application.') else: from kay.conf import settings if settings.PROFILE and 'update' in sys.argv: print_status('--------------------------\n' \ 'WARNING: PROFILER ENABLED!\n' \ '--------------------------') except KeyboardInterrupt: print_status('Interrupted.') sys.stdout = old_stdout sys.stderr = old_stderr evt = ThreadEndEvent() wx.PostEvent(self.win, evt)
def do_appcfg_passthru_argv(): """ Execute appcfg.py with specified parameters. For more details, please invoke 'python manage.py appcfg --help'. """ from google.appengine.tools import appcfg progname = sys.argv[0] if len(sys.argv) < 3: sys.stderr.write('action required.\n') sys.exit(1) if 'update' in sys.argv: do_preparse_apps() models = get_all_models_as_dict() args = [] for arg in sys.argv[2:]: args.append(arg) if arg == "request_logs": args.append(os.getcwdu()) if "--help" in args or "help" in args or "request_logs" in args: args = [progname] + args else: args = [progname] + args + [os.getcwdu()] logging.basicConfig(format=('%(asctime)s %(levelname)s %(filename)s:' '%(lineno)s %(message)s ')) try: app = appcfg.AppCfgApp(args, parser_class=HookedOptionParser) result = app.Run() if result: sys.exit(result) except KeyboardInterrupt: print_status('Interrupted.') sys.exit(1) from kay.conf import settings if settings.PROFILE and 'update' in sys.argv: print_status( '--------------------------\n' 'WARNING: PROFILER ENABLED!\n' '--------------------------' )