This sounds like a path type issue and these sorts of things are a PITA to sort out. Have you tried setting the settings path a bit more explitly:
os.environ["DJANGO_SETTINGS_MODULE"]="django_project.settings" I had some trouble with kind of thing in a project I was working on (https://launchpad.net/django-audit/). I wrote a test suite which needed a fake Django app to test a load of things and I had to use the full path to the settings file: os.environ['DJANGO_SETTINGS_MODULE'] = "tests.fixtures.sampledjango.settings" Are you installing the application using setuptools? If not and you can't put it in the site-packages, I'd consider using a virtualenv. Euan On Jun 11, 2:11 pm, Stodge <[email protected]> wrote: > I'm writing an install script that resides in django_project/install > and one of things it does, is programmatically run syncdb. My current > code for this is correct if I do: > > cd .. > python > import os > os.environ["DJANGO_SETTINGS_MODULE"]="settings" > from django.core.management import call_command > call_command('syncdb', interactive=False) > > If I copy this code into my installer, or indeed do the same as above, > but inside the django_project/install directory it fails: > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/usr/lib/python2.6/site-packages/django/core/management/ > __init__.py", line 166, in call_command > return klass.execute(*args, **defaults) > File "/usr/lib/python2.6/site-packages/django/core/management/ > base.py", line 221, in execute > self.validate() > File "/usr/lib/python2.6/site-packages/django/core/management/ > base.py", line 249, in validate > num_errors = get_validation_errors(s, app) > File "/usr/lib/python2.6/site-packages/django/core/management/ > validation.py", line 28, in get_validation_errors > for (app_name, error) in get_app_errors().items(): > File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", > line 145, in get_app_errors > self._populate() > File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", > line 60, in _populate > self.load_app(app_name, True) > File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", > line 82, in load_app > if not module_has_submodule(app_module, 'models'): > File "/usr/lib/python2.6/site-packages/django/utils/ > module_loading.py", line 14, in module_has_submodule > for entry in package.__path__: # No __path__, then not a package. > AttributeError: 'module' object has no attribute '__path__' > > I've tried adding the project's path to sys.path, but that doesn't > make a difference. Is there a way to do this from a sub-directory? > Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

