On Thu, 2007-03-29 at 14:26 +0200, Lukas Kolbe wrote:
> Hi!
> 
> I have a problem I came across for a while now.
> 
> To start the fcgi-instance, I use manage.py as follows:
> 
> su -c "DJANGO_DB_NAME=dbname DJANGO_DB_PASS=dbpass \
>   DJANGO_DB_USER=dbuser DJANGO_SECRET_KEY=secret \
>   /srv/vhosts/myhost/site/manage.py runfcgi daemonize=false \
>   socket=/srv/sockets/django-einfachkaffee.de.socket" \
>   webuser
> 
> I need the environment variables because they get used in site.settings.
> 
> manage.py sets sys.path as follows:
> 
> 
> ['/srv/vhosts/myhost/site', '/usr/lib/python24.zip',
> '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2',
> '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload',
> '/usr/local/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages/PIL',
> '/var/lib/python-support/python2.4']
> 
> while the first element clearly should be /srv/vhosts/myhost/,
> not /srv/vhosts/myhost/site. Consequently, manage.py does do nothing but
> spit an error - 
> 
> EnvironmentError: Could not import settings 'site.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named settings

What is actually raising this error? Inside Django, we only do "import
settings" everywhere, as far as I can see -- we intentionally don't use
the project directory name (because it need not exist). For example,
manage.py only has "import settings" in it's code.

So is this error being raised from somewhere in your own code or inside
Django's code? I realise that the error message itself is coming from
django.conf, because I recognise the text, but I'm interested in what is
trying to use that name to do the import (rather than just "settings").

By default, manage.py only adds the directory containing manage.py to
the Python path, so what you are seeing here as your path is expected
behaviour. 

> Of course, because settings.py lives in /srv/vhosts/myhost/site/,
> not /srv/vhosts/myhost/site/site!
> 
> Is there anything I can do about it?

I think the solution is not to try to import settings under that name,
but since I don't know how/why that is happening at the moment, I'm not
sure if it's something under your control or something inside Django.

Otherwise, the solution is probably to set PYTHONPATH to include both
your project directory and the location of the Django source (from a
later message in this thread, it looks like your Django source is not
installed inside /usr/lib/python*/site-packages -- true?).

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to