On Jan 6, 11:01 am, Josh Ourisman <[EMAIL PROTECTED]> wrote: > Perhaps also worth > mentioning, is that if I don't put 'SetEnv PYTHON_EGG_CACHE /home/ > django/.python-eggs' in my vhosts.conf I get errors saying that / > root/.python-eggs is unreadable, though I have no idea why it should > be trying to get at anything in /root.
The way that default location for Python egg cache is calculated if PYTHON_EGG_CACHE environment variable not set is a bit stupid. Rather than actually look up the home directory of the user from the account information it simply trusts the value of $HOME. Problem is that $HOME is actually rather unreliable. In the case of Apache, because it is usually started as root from system startup scripts, it will inherit $HOME from the root user. Apache actually then changes to run as a special user, but $HOME stays the same as it is a simple effective uid change and not an actual login, and thus that user will not have access to $HOME of root. Thus you see what you do. For Apache at least, even if location of Python egg cache directory was calculated from account home directory, it wouldn't help. This is because the Apache user doesn't usually have a dedicated home directory of its own which it could write to. Worse even again is that if a user uses sudo to execute apachectl to restart Apache and doesn't pass the -H option to sudo, it will inherit the environment of the user. Thus $HOME will be that of the user which will also cause problems. That this happens with sudo is part argument for applications not to rely on $HOME. So, setting PYTHON_EGG_CACHE when running Python embedded in Apache is definitely required. Some more commentary on this issue can be found in section 'User HOME Environment Variable' of: http://code.google.com/p/modwsgi/wiki/ApplicationIssues Graham --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---