On 8/19/06, Jon Atkinson <[EMAIL PROTECTED]> wrote: > I've tried also writing a stand-alone script and importing > the necessary modules, but I'm having problems with > DJANGO_SETTINGS_MODULE not being set (it seems that django does some > magic which is beyond me at this point) - am I approaching this in the > correct way, and if so what do I need to import/read from settings.py > so that a stand-alone script can interact with my models?
There's not really any "magic" involved; DJANGO_SETTINGS_MODULE is just an environment variable, so doing this at the top of your script should work: import os os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings' -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---