def main(args): loader = DpyLoader(globals()) from django.core.management import call_command call_command('initdb', interactive=args.interactive) os.chdir(os.path.dirname(__file__)) loader.initialize() args = (globals(), locals()) execfile("dumps_foo.py", *args) loader.finalize() logger.info("Loaded %d objects", loader.count_objects) call_command('resetsequences')