ValueError:无法配置处理程序'文件':[Errno 13]权限被拒绝:

时间:2018-01-23 15:29:48

标签: python django python-2.7

使用Django 1.11和Python 2.7。

我无法配置处理程序' file'应得权利。

回溯如下:



Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 337, in execute
    django.setup()
  File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 22, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/usr/local/lib/python2.7/site-packages/django/utils/log.py", line 75, in configure_logging
    logging_config_func(logging_settings)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 794, in dictConfig
    dictConfigClass(config).configure()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 576, in configure
    '%r: %s' % (name, e))
ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/var/log/welnity/debug.log'
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

看起来应用程序无法访问文件夹/日志文件。试试

chmod 777

到该文件夹​​,然后重试。

注意请不要在PROD环境中设置777

答案 1 :(得分:0)

在项目所在的根驱动器中的此子目录(:/ var / www / logs / projectname)后面创建以下文件示例,如果项目的名称为Towns并且位于驱动器D中,请转到驱动器D并创建一个新的文件夹var,然后在该www中记录项目名称。在我的情况下,D:/ var / www / logs / towns另外,请确保此路径可用