Tag Archives: logging error Permission Error [WinError 32]

Django Use logging Module Cannot Operate the File Error: logging error Permission Error [WinError 32]

Causes:

This problem is only encountered during development, and the configuration is written to setting Py configuration file. We define the log file size. When the log is full, we will encounter this problem, because when running Django with pychart, we enable both processes to initialize setting Py configuration, one is accessed normally, and the other is used to monitor code changes (you will find that Django will rebuild itself every time you modify some code, which is completed by this process). Because it occupies the handle of the file, it fails during archiving

Solution:

Method 1: add the — noreload parameter when starting Django

For example, python manage py runserver 127.0.0.1:8080 –noreload

After adding the — noreload parameter, when the development server is started, the Python code of Django project is modified, and the server will not restart automatically

Method 2:

Expand log files

Modify setting.Py to expand maxbytes