On 30 November 2010 06:09, [email protected] <[email protected]> wrote:
>
> On Nov 29, 2010, at 1:57 PM, Graham Dumpleton wrote:
>
>> What setup.py file are you talking about?
>
> The django settings.py, sorry.  The issue is that, if I initialize the 
> logging within settings.py, the log files are created as root with rw for 
> root only and no privs for anyone else.  Later, when I go to write to them 
> from my django code, I get a permission denied error.

Can't see how that can be the case. User Python code should never run
as root within mod_wsgi.

Suggest you add logging to your settings.py.

  import os, sys

  print >> sys.stderr, 'UID %d' % os.getuid()

  mask = os.umask()
  os.umask(mask)

  print >> sys.stderr, 'UMASK %o' % mask

The only way it could is if Apache had been hacked on install to
supply '-D SECURITY_HOLE_PASS_AUTHORIZATION', which would allow User
directive in Apache to be 'root'.

That is dangerous and is not a good idea.

What user does your Apache actually run as? Has it been hacked and
configured so it runs as root?

>> What is your Apache configuration for mod_WSGI? Ie., what mod_WSGI
>> directives etc?
>
> Virtual host
> ---------------
>
> ##
> # Generated on: 2010-11-27 22:14:44.112723
> ##
>
> <VirtualHost XXX.XXX.xxx.xxx:8080>
>
>    ServerName data.domain.com
>    ServerAdmin [email protected]
>
>    WSGIDaemonProcess tbp_data threads=15  \
>        python-path=/var/www/web-apps/tbp_data/lib/python2.7/site-packages
>
>        WSGIScriptAlias / /var/www/web-apps/tbp_data/server-conf/wsgi.py
>        WSGIProcessGroup tbp_data
>
>    <Directory /var/www/web-apps/tbp_data/server-conf>
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>    LogLevel warn
>    CustomLog /var/log/apache2/data.domain.com.access.log combined
>    ErrorLog /var/log/apache2/data.domain.com.error.log
>
> </VirtualHost>
>
> --------------------------------------------------
>
> wsgi.py
> ----------
> # Generated on: 2010-11-27 22:14:44.112723
>
> import sys
> import os
>
> sys.stdout = sys.stderr     # hack to get print to go to error log

This shouldn't be required if you are using mod_wsgi 3.X.

> os.environ['DJANGO_SETTINGS_MODULE'] = 'tbp_data.settings'
> print 'tbp_data starting...'
>
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()


Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to