Django上的日志文件设置写入权限 [英] Setting write permissions on Django Log files

查看:1239
本文介绍了Django上的日志文件设置写入权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组Django的日志文件,我有相应的记录集写出来的消息。不过每次创建新的日志文件时,文件上的权限不允许我启动shell,有时会导致问题与Apache。

I have a set of Django Log files, for which I have the appropriate logger set to write out messages. However each time it creates a new log file, the permissions on the file don't allow me to start the shell, and at times cause issues with apache.

我已经跑搭配chmod 777 -rv上的目录,其中规定所有权限,所以我们可以做我们喜欢,但创建的下一个日志文件,可以追溯到一些默认的。

I have ran chmod -Rv 777 on the directory, which sets all the permissions so we can do what we like, but the next logfile created, goes back to some default.

我如何设置要创建的日志文件的权限

How can I set permissions on the logfiles to be created

马克

推荐答案

这是由特定用户创建的文件权限取决于设置什么面膜为这个特定的用户。

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

现在,您需要设置相应的权限,谁运行Apache服务

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

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

然后为特定用户运行的Apache(www数据?)

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

sudo chown -R your_user:user_running_apache directory

其中的目录的是你的Django应用程序的根目录。
为了确保所有将被添加到该目录在今后的文件有
正确的权限运行:

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 have the correct permissions run:

sudo chmod -R g+s directory

这篇关于Django上的日志文件设置写入权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆