def run_appcfg(argv): # import this so that we run through the checks at the beginning # and report the appropriate errors import appcfg # We don't really want to use that one though, it just executes this one from google.appengine.tools import appcfg # Reset the logging level to WARN as appcfg will spew tons of logs on INFO logging.getLogger().setLevel(logging.WARN) new_args = argv[:] new_args[1] = 'update' new_args.append('.') syncdb = True if '--nosyncdb' in new_args: syncdb = False new_args.remove('--nosyncdb') appcfg.main(new_args) if syncdb: from django.core.management import call_command from django.db import connection connection.setup_remote() print 'Running syncdb.' call_command('syncdb', remote=True, interactive=True) from django.conf import settings if getattr(settings, 'ENABLE_PROFILER', False): print '--------------------------\n' \ 'WARNING: PROFILER ENABLED!\n' \ '--------------------------'
def run_appcfg(argv): # import this so that we run through the checks at the beginning # and report the appropriate errors import appcfg # We don't really want to use that one though, it just executes this one from google.appengine.tools import appcfg # Reset the logging level to WARN as appcfg will spew tons of logs on INFO logging.getLogger().setLevel(logging.WARN) new_args = argv[:] new_args[1] = "update" new_args.append(".") syncdb = True if "--nosyncdb" in new_args: syncdb = False new_args.remove("--nosyncdb") appcfg.main(new_args) if syncdb: from django.core.management import call_command from django.db import connection connection.setup_remote() print "Running syncdb." call_command("syncdb", remote=True, interactive=True) from django.conf import settings if getattr(settings, "ENABLE_PROFILER", False): print "--------------------------\n" "WARNING: PROFILER ENABLED!\n" "--------------------------"
def run_appcfg(argv): # import this so that we run through the checks at the beginning # and report the appropriate errors import appcfg # We don't really want to use that one though, it just executes this one from google.appengine.tools import appcfg # Reset the logging level to WARN as appcfg will spew tons of logs on INFO logging.getLogger().setLevel(logging.WARN) # Note: if we decide to change the name of this command to something other # than 'update' we will have to munge the args to replace whatever # we called it with 'update' new_args = argv[:] new_args.append('.') syncdb = True if '--nosyncdb' in new_args: syncdb = False new_args.remove('--nosyncdb') appcfg.main(new_args) if syncdb: from django.core.management import call_command from django.db import connection connection.setup_remote() print 'Running syncdb.' call_command('syncdb', remote=True, interactive=True) from django.conf import settings if getattr(settings, 'ENABLE_PROFILER', False): print '--------------------------\n' \ 'WARNING: PROFILER ENABLED!\n' \ '--------------------------'
def handle_default_options(options): """ Include any default options that all commands should accept here so that ManagementUtility can handle them before searching for user commands. """ if options.settings: os.environ['DJANGO_SETTINGS_MODULE'] = options.settings if options.pythonpath: sys.path.insert(0, options.pythonpath) if options.remote: from django.db import connection connection.setup_remote()