debugDay2017-05-09
今天在动车上完成了一次debug,内心其实害怕解不开。 还是解开了。
写给6个月之前的许从用:
亲爱的自己,其实bug没那么可怕,只是内心的一个害怕 计算机本身并没有排挤我们,他在很实在的告诉我们错误在哪里。 让我们读懂他给我们的文字。 尊重计算机告诉我们的错误地方。 就可以解开这个bug。
- 计算机本质上还是在做01处理和数据库交互,从本质看问题。
- 告诉小黄鸭错在哪里,一句一句的翻译。慢其实不一定是坏事。
Unhandled exception in thread started by
没有把手,例外在线开始于
<function check_errors.<locals>.wrapper at 0x103c99d08>
方法排查错误<本地>包装在0x103c99d08
Traceback (most recent call last):
返回值:很多不久之前的错误
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/config.py", line 558, in configure
handler = self.configure_handler(handlers[name])
文件 configure
驯兽师 = 配置驯兽师
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/config.py", line 731, in configure_handler
result = factory(**kwargs)
文件 config.py 在配置驯兽师
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/handlers.py", line 150, in __init__
文件:150,在__init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/handlers.py", line 57, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 1025, in __init__
StreamHandler.__init__(self, self._open())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 1054, in _open
返回 打開文件
return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/sourceDns/log/all.log'
文件沒有打開,沒有找到目錄:'/sourceDns/log/all.log
During handling of the above exception, another exception occurred:
在什麼期間沒有配置在上面,可能包括,再一的發生
Traceback (most recent call last):
痕跡(沒有反悔)
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/__init__.py", line 22, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/Users/VANXV/.virtualenvs/zss322/lib/python3.6/site-packages/django/utils/log.py", line 75, in configure_logging
logging_config_func(logging_settings)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/config.py", line 795, in dictConfig
dictConfigClass(config).configure()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/config.py", line 566, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure handler 'default': [Errno 2] No such file or directory: '/sourceDns/log/all.log'
看见这么长的bug是不是很可怕? 第一步:我们很笨拙的一个一个单词翻译,其实这样没有什么不好的。找到了错误的根源 第二步:在google查,为什么错误。原来有很多人和我们一样有这个报错。 第三步:改setting.py 文件处理。