Graham Carlyle wrote: > The pending ability to allow custom application commands made me think > about a few on-off scripts i have that i wouldn't want to have available > as a command but do django stuff from the command line. > > Maybe its worth adding a new core command for invoke these sorts of > scripts? Rather than having to manipulate the sys.path & os.environ in > each case.
I want that command to. In the meantime though, we've got a command that runs like this: python test_shell.py <module.path.name> Drop that test_shell.py in the root of your app. It's this: test_shell.py ------ #!/usr/bin/env python from django.core.management import execute_manager, setup_environ import sys try: import settings # Assumed to be in the same directory. except ImportError: sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) project_directory = setup_environ(settings) from django.db.models.loading import get_models loaded_models = get_models() if sys.argv and len(sys.argv) > 1: __import__(sys.argv[1]) else: print 'test_shell.py <module>' That work for you in the meantime? Should give your script equivalent capabilities to "shell". George --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---