生产服务器现在正在运行,我只是在VPS终端中运行 python manage.py shell ,但它说:
Traceback (most recent call last):
File "/usr/lib/python3.5/logging/config.py", line 558, in configure
handler = self.configure_handler(handlers[name])
File "/usr/lib/python3.5/logging/config.py", line 731, in
configure_handler
result = factory(**kwargs)
File "/usr/lib/python3.5/logging/handlers.py", line 150, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding,
delay)
File "/usr/lib/python3.5/logging/handlers.py", line 57, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python3.5/logging/__init__.py", line 1008, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python3.5/logging/__init__.py", line 1037, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied:
'/var/log/mysite/mysite.log'
我该怎么办?
答案 0 :(得分:0)
您有2个选择:
1-更改文件/var/log/mysite/mysite.log
的权限,以便其他用户可以写入该文件。像chmod 666 /var/log/mysite/mysite.log
2-从root
或拥有/var/log/mysite/mysite.log
的用户那里运行shell脚本