创建django项目下的子应用出现了问题,环境没用问题
# python ../../manage.py startapp users
['/root/桌面/novel_chenglm/novel_chenglm_pro/novel_chenglm_pro/apps', '/root/桌面/novel_chenglm/novel_chenglm_pro', '/usr/local/lib/python38.zip', '/usr/local/lib/python3.8', '/usr/locab/python3.8/lib-dynload', '/root/.virtualenvs/novel_chenglm_pro/lib/python3.8/site-packages']
Traceback (most recent call last):
File "/usr/local/lib/python3.8/logging/config.py", line 563, in configure
handler = self.configure_handler(handlers[name])
File "/usr/local/lib/python3.8/logging/config.py", line 744, in configure_handler
result = factory(**kwargs)
File "/usr/local/lib/python3.8/logging/handlers.py", line 148, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/local/lib/python3.8/logging/handlers.py", line 55, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/local/lib/python3.8/logging/__init__.py", line 1143, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/local/lib/python3.8/logging/__init__.py", line 1172, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/root/桌面/novel_chenglm/novel_chenglm_pro/logs/novel2023.log'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "../../manage.py", line 22, in <module>
main()
File "../../manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/root/.virtualenvs/novel_chenglm_pro/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/root/.virtualenvs/novel_chenglm_pro/lib/python3.8/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/root/.virtualenvs/novel_chenglm_pro/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/root/.virtualenvs/novel_chenglm_pro/lib/python3.8/site-packages/django/utils/log.py", line 76, in configure_logging
logging_config_func(logging_settings)
File "/usr/local/lib/python3.8/logging/config.py", line 808, in dictConfig
dictConfigClass(config).configure()
File "/usr/local/lib/python3.8/logging/config.py", line 570, in configure
raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'file'
发现是日志器出现问题,把原来的写入日志的代码注释掉,可以正常运行,后检查发现日志写入的路径不对,修改后成功运行