However you run django, you must configure the appropriate path
settings so that it can load your modules. If you have setup your
folder layout like this:
/path/to
foo/
settings.py
bar/
Where 'foo' is your project and 'foo.bar' is your app, then you will
need to add /path/to to sys.path.
If on the other hand 'bar' is how you refer to your app, then you will
need to add /path/to/foo to sys.path as well.
>
> I am running python 2.6.5 under Ubuntu 10.04.2 LTS
>
> Aside: I found that I could make it work with just `/path/to` in
> sys.path if I changed my code to qualify all references to
> applications, i.e. use `mysite.app1` and `mysite.app2` everywhere
> instead of just `app1` and `app2`. But that's messy. In fact, I would
> like to be able to remove all references to `mysite` within the code,
> but there are a few places it seems to be necessary; in particular,
> whenever I want to pull something out of the toplevel SETTINGS file I
> end up writing
>
> ~~~~
> from mysite import settings
> ~~~~
>
> Am I missing a trick here? If /path/to/mysite is on the path, would it
> be safe to use "import settings" instead of "from mysite import
> settings" everywhere?
>
You're missing several - you should *never* directly import your
settings like that. The only reliable and approved way to access your
settings is:
from django.conf import settings
Cheers
Tom