I'm writing a Trac plugin that interacts with an existing Django
environment. I'm trying to use the following code, which works nicely
when used in a Mercurial hook:

        sys.path.append("/var/www/sites/indigo/")
        os.environ['DJANGO_SETTINGS_MODULE'] = 'indigo.settings'
        from django.core.management import setup_environ
        import settings
        project_directory = setup_environ(settings)

This works fine, but if I then do:

        from django.contrib.auth.models import User

I get:

        ImportError: Could not import settings 'indigo.settings' (Is it on
sys.path? Does it have syntax errors?): No module named settings

The exact same code works in my Mercurial hook, so any ideas what
might be different?
Thanks

--

You received this message because you are subscribed to the Google Groups "Trac 
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/trac-users?hl=en.


Reply via email to