Setting write permissions on Django Log files Setting write permissions on Django Log files apache apache

Setting write permissions on Django Log files


Permissions on files created by a particular user depend on what mask is set for this particular user.

Now you need to set the appropriate permissions for whoever is running the apache service

ps -aux | grep apache | awk '{ print $1 }'

Then for this particular user running apache (www-data?)

sudo chown -R your_user:user_running_apache directory

where directory is the root directory of your django application.To make sure that all the files that will be added to this directory in the future havethe correct permissions run:

sudo chmod -R g+s directory


I faced with the same problem - I had issues with starting shell and with celery due to rotated-log file permissions. I'm running my django-project through the uwsgi (which is running by www-data user) - so I handled it by setting umask for it (http://uwsgi-docs.readthedocs.org/en/latest/Options.html#umask).

Also I'm using buildout, so my fix looks like this:

[uwsgi]recipe = buildout.recipe.uwsgixml-socket = /tmp/uwsgi.sockxml-master = Truexml-chmod-socket = 664xml-umask = 0002xml-workers = 3xml-env = ...xml-wsgi-file = ...

After this log file permissions became 664, so group members of www-data group can also write into it.