简体   繁体   中英

ValueError: Unable to configure handler 'file': [Errno 13] Permission denied:

Using Django 1.11 and Python 2.7.

I am unable to configure handler 'file' dues to permissions.

Traceback is as follows:

 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'

Looks like the application does not have access to the folder/log file. try

chmod 777

to the folder and try again.

Note : Please do not set 777 in PROD env .

Create the following files following this sub-directory(:/var/www/logs/projectname) in the root drive where your project is located Example, if the project's name is towns and is located in drive D, go to drive D and create a new folder var and in that www in that logs then the project name. In my case, D:/var/www/logs/towns Also, make sure this path is available

Traceback says, that it's no "log" directory.

  1. Create directory with name log in path
    /usr/local/lib/python2.7/site-packages/django/core/management/
  2. Create empty file .gitkeep
  3. After creating .gitkeep file, push it to GitHub

If you're running the server please add sudo before the python. Meaning run:

sudo python manage.py your_commade

your_commade can be runserver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM