On Mon, 2009-10-05 at 15:52 +0200, Ralph Heinkel wrote:
> Hi,
> 
> We have an automatic build system with scons and through this we want 
> to initialize djangos tables.
> 
> This is a weird problem:
> - If I run "python manage.py syncdb" from my unix shell,
>    all tables are nicely created.
> - If run run the same command from a SConstruct script,
>    only django's system tables are created but none of my
>    own models!!
> 
> How can this be? No errors are shown, it is like my models do not exist.
> 
> The SConstruct looks like this:
> 
> env.Command('initdb', '', 'python manage.py syncdb --noinput')
> 
> 
> 
> Trying to find out what's going on I changed the scons command to
> 
> env.Command('initdb', '', '/bin/bash')
> 
> So a new shell is started for this target. If I then manually type 
> "python manage.py syncdb" in this subshell I can indeed reproduce this 
> problem -- none of my models is found/created, only system tables are 
> created!! After leaving the subshell (and hence scons) everything 
> works fine again.
> 
> Anyone any clue??
> 
> Thanks,
> 
> Ralph
> 
> 
> (opensuse 11.0, django 1.1, python 2.6, scons 1.2.0)
> 

At a guess, the sub interpreter is not getting the same PYTHONPATH as
the parent. Therefore, when django enumerates the apps to sync for, your
app + models are not found, and therefore not synched.

That is an absolute guess, confirm by verifying the values of PYTHONPATH
in original shell and scons created subshell.

Cheers

Tom


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to