tags:

views:

15

answers:

2

From the Django shell (manage.py shell), when attempting to import a python module that uses logging I run into permission problems: the log files are owned by the web app user

IOError: [Errno 13] Permission denied: '/path/to/my.log'

Is there a way to disable / mock / otherwise work around this issue so I can use the module from the shell?

A: 

you could use a try-except block: try to write to the log file and if theres an IOException, either write the log somewhere else (/tmp or in the current directory) or just disable logging.

See also: http://docs.python.org/tutorial/errors.html#handling-exceptions

Alex
A: 

Use an alternate settings file that loads all of the normal settings and then modifies the location of the log file.

Ignacio Vazquez-Abrams