On Sat, Mar 14, 2009 at 9:16 PM, Jim Hickstein <j...@jxh.com> wrote: > > I am trying to set up my Django app behind Apache with mod_python, and > you may have seen this error many times before, but the underlying > EACCES really puzzles me. > > CentOS 5.2, Apache 2.2.3, mod_python 2.4.3. /etc/httpd/conf/ > httpd.conf says, in part: > > <Location "/ambassador/"> > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE ambassador.settings > PythonOption django.root /ambassador > PythonDebug On > PythonPath "['/var/www/amb-django', '/var/www'] + sys.path" > </Location> > > Trying to reach the first page (https://host/) gets the oft-heard > refrain that ends in: > > ImportError: Could not import settings 'ambassador.settings' (Is it on > sys.path? Does it have syntax errors?): No module named > ambassador.settings > > Well, yes it is on sys.path at that point. A quick edit to /usr/lib/ > python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/conf/ > __init__.py, line 94, to print sys.path in the exception showed that > it was there, on the front, just as PythonPath did it. > > So maybe it's a permission issue. The directory is there: > > drwxr-xr-x 23 root root 4096 Mar 4 03:07 / > drwxr-xr-x 21 root root 4096 Mar 14 15:02 /var > drwxr-xr-x 8 root root 4096 Mar 14 19:51 /var/www > drwxr-xr-x 4 apache apache 4096 Mar 14 15:46 /var/www/amb-django > drwxr-xr-x 4 apache apache 4096 Mar 14 20:34 /var/www/amb-django/ > ambassador > -rw-r--r-- 1 apache apache 2905 Mar 14 20:30 /var/www/amb-django/ > ambassador/settings.py > -rw-r--r-- 1 apache apache 1929 Mar 14 20:34 /var/www/amb-django/ > ambassador/settings.pyc > > Running this behind a regular Apache (sudo /etc/init.d/httpd start) > fails with the above error, but stopping that and running just "sudo / > usr/sbin/httpd -X" _works_. So much for getting a clean strace that > way. So a dirty strace: sudo strace -ff -o /tmp/apache /etc/init.d/ > httpd start. One of its outputs says: > > stat64("/var/www/amb-django/ambassador", 0xbf94f914) = -1 EACCES > (Permission denied) > > Now how in the world can _that_ happen? "man 2 stat" says EACCES > results if you lack execute permission on some enclosing directory. > As you can see above, no one lacks that permission. This process had > earlier done > > setuid32(48) = 0 > > and 48 is "apache". WTFO? / is ext3, no funny business (that I know > about) with ACLs or anything. Just a bog-standard CentOS 5.2. > > Linux myhostname 2.6.18-92.el5PAE #1 SMP Tue Jun 10 19:22:41 EDT 2008 > i686 i686 i386 GNU/Linux > > > > > This isn't stricly related, probably, but you generally shouldn't be putting your django projects in your docs root: http://www.djangobook.com/en/2.0/chapter02/#cn76 explains why not. Perhaps by moving it you will also have more luck with the issue you came here to solve :)
Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---