Hi.

I would like to use django models on external scripts to
initialize/modify the database. Is it possible?

I've followed the instructions of the tutorial (set
DJANGO_SETTINGS_MODULE='website.settings' and importing
website.settings works on python shell) but haven't been able to get it
to work with this simple script:

from models import Format
[f.save() for f in (
        Format(order= 1, name='One'),
        Format(order= 2, name='Two'),
)]

Executing "initialize.py" on the command line always shows the error:
EnvironmentError: Could not import settings ''website.settings'' (is it
on sys.path?): No module named 'website.settings'. (Yes, it is on
sys.path).

and if I try to import the script under manage.py shell it shows:
AttributeError: 'Format' object has no attribute 'id'.

I'm using the latest Magic Removal Branch on Windows XP and Python
2.4.3.

Thanks


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to