728x90
| 에러명 :
[Django 에러]
UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 9735: illegal multibyte sequence
(+)
[웹브라우저] A server error occurred. Please contact the administrator. 에러 발생
| 해결방법 :
가상환경(venv) 폴더에서 Lib\site-packages\django\views\debug.py 수정
[기존]
def get_traceback_html(self):
"""Return HTML version of debug 500 HTTP error page."""
with Path(CURRENT_DIR, 'templates', 'technical_500.html').open() as fh:
t = DEBUG_ENGINE.from_string(fh.read())
c = Context(self.get_traceback_data(), use_l10n=False)
return t.render(c)
[수정후 : open() 안에 encoding="utf-8" 추가 기입]
def get_traceback\_html(self):
"""Return HTML version of debug 500 HTTP error page."""
with Path(CURRENT_DIR, 'templates', 'technical_500.html').open(encoding="utf-8") as fh:
t = DEBUG\_ENGINE.from_string(fh.read())
c = Context(self.get_traceback_data(), use_l10n=False)
return t.render(c)
| 위의 코드를 추가 기입하고 가상환경 활성화를 다시 껐다 키고 나서 해당 브라우저를 확인해보면,
html 상에서 오류를 발생시키는 문제의 code를 알려준다. Error Tracking과 같은 역할을 한다고 볼 수 있다.
728x90
'TIL > Error해결사' 카테고리의 다른 글
[Git] 폴더 및 파일명의 대소문자 수정 및 적용 (0) | 2022.07.28 |
---|---|
[React] 컴파일 에러 Node Sass version 에러 (0) | 2021.05.12 |
[Window] cmd process kill (0) | 2021.05.07 |
Eclipse+Git+Push+Error+'rejected non-fast-forward' (0) | 2021.03.12 |
백준(JAVA) 런타임 에러 해결 (0) | 2021.01.07 |
댓글