On Mon, Oct 6, 2008 at 10:10 AM, Gerard flanagan <[EMAIL PROTECTED]>wrote:
> > Hello, > > I have a utility script 'load_data.py' that primes a database with dummy > data via the application Models. It sits in my project root directory: > > myproj/ > settings.py > manage.py > load_data.py > ... > myapp/ > ... > > When I do 'python manage.py shell' and import a function from the script: > > >>> from load_data import load_all > >>> load_all() > > everything works. > > But when I do 'python load_data.py' I get an ImportError: No module > named myproj.myapp. > > If your code contains imports of the form myproj.myapp, then the directory containing myproj needs to be on your PYTHONPATH when you run the script. (manage.py shell does this for you automatically so that is why it works there.) Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---