def run_shell(use_plain=False):
 from django.db.models.loading import get_models
 loaded_models = get_models()
 try:
  if use_plain:
   raise ImportError
  import IPython
  shell = IPython.Shell.IPShell(argv=[])
  shell.mainloop()
 except ImportError:
  import code
  try:
   import readline
  except ImportError:
   pass
  else:
   import rlcompleter
   readline.parse_and_bind('tab:complete')
  code.interact()

def run_shell ( use_plain = False ) : from django . db . models . loading import get_models loaded_models = get_models ( ) try : if use_plain : raise ImportError import IPython shell = IPython . Shell . IPShell ( argv = [ ] ) shell . mainloop ( ) except ImportError : import code try : import readline except ImportError : pass else : import rlcompleter readline . parse_and_bind ( 'tab:complete' ) code . interact ( )
runs a python interactive interpreter .