On Tue, Dec 25, 2012 at 8:22 AM, huw_at1 <huwdjo...@gmail.com> wrote:

> Hi,
>
> This has probably been asked a million times before so apologies. I'm new
> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to
> perform a simple import from within my shell:
>
> from django.contrib.sites.models import Site
>
> However I am constantly getting the problem that my settings are not being
> found:
>
>     raise ImportError("Could not import settings '%s' (Is it on
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'test.test.settings' (Is it on
> sys.path?): No module named test.settings
>
> In the past I would have thought that this was an issue as the project and
> the "app" had the same name although in the case of 1.4 the settings are
> placed in a directory with the same name as the project. I'm not sure what
> I should change to get this to work.
>
> Has this been seen before or any ideas?
>
> Many thanks
>
>
> The only shell from which you can perform this import is the one you reach
via:

    python manage.py shell

If you just start python, such imports will not work.

Note, too, that the directory containing manage.py should be the current
directory at the time that python is started (as opposed to adding that
directory to sys.path.

You can do a lot of typing and get a bare python into a state from which it
can import Site, but it would be far more productive to teach your IDE to
start a shell as above for those times when you want to play like this.

Bill

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