Re: import models doesn't work in a script

2006-08-25 Thread 83311
Waylan Limberg wrote: > > Thx - it works - but why? > > ;-) > > I'm guessing you used manage.py shell??? That sets the > DJANGO_SETTINGS_MODULE to the setting.py file in the current directory > for you so everything just works. Nope - I've used the "normal" Python-Interpreter. Timothy --~

Re: import models doesn't work in a script

2006-08-25 Thread Waylan Limberg
On 8/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > Try this: > > > > import sys > > import os > > sys.path.append('path to where mysite is') > > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' > > > > from mysite.myapp.views import * > > from mysit

Re: import models doesn't work in a script

2006-08-25 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > Try this: > > > > import sys > > import os > > sys.path.append('path to where mysite is') > > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' > > > > from mysite.myapp.views import * > > from mysite.myapp.models import * > > Thx - i

Re: import models doesn't work in a script

2006-08-25 Thread 83311
Nathan R. Yergler wrote: > Because the environment variable (DJANGO_SETTINGS_MODULE) needs to point > to the Python module in Python package syntax (ie, dotted path syntax). Okay - I thought it must be in Linux-Syntax (full-path). But why does it works in the Interpreter with the Linux-Syntax (/h

Re: import models doesn't work in a script

2006-08-25 Thread Nathan R. Yergler
Because the environment variable (DJANGO_SETTINGS_MODULE) needs to point to the Python module in Python package syntax (ie, dotted path syntax). So the package ("mysite" in the example below) must be on the Python path (which is what sys.path.append does below). On Fri, 2006-08-25 at 11:52 -0700,

Re: import models doesn't work in a script

2006-08-25 Thread 83311
[EMAIL PROTECTED] wrote: > Try this: > > import sys > import os > sys.path.append('path to where mysite is') > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' > > from mysite.myapp.views import * > from mysite.myapp.models import * Thx - it works - but why? ;-) Timothy --~--~

Re: import models doesn't work in a script

2006-08-25 Thread [EMAIL PROTECTED]
Try this: import sys import os sys.path.append('path to where mysite is') os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from mysite.myapp.views import * from mysite.myapp.models import * --~--~-~--~~~---~--~~ You received this message because you are