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.
--
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = "Runs a python script in the django environment."
args = '[script] [args...]'
def handle(self, *args, **options):
script = args[0]
execfile(script)
--
from fooapp import models
print models.Bar.objects.get(name=args[1])
--
./manage runscript hacks/printbar.py "bob"
--
hmm... or maybe not
Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---