Q&A
책을 따라하다가 막히는 부분이 있나요?
질문을 남겨주세요.
하지만, 책을 끝까지 읽고 나면 이 페이지도 만드실 수 있을거에요.
265p post_list 모듈화 에러
2 years, 6 months ago
moonn9389Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
E
======================================================================
ERROR: test_post_list (blog.tests.TestView)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\github\django\blog\tests.py", line 11, in test_post_list
response = self.client.get('/blog/')
File "C:\github\django\venv\lib\site-packages\django\test\client.py", line 836, in get
response = super().get(path, data=data, secure=secure, **extra)
File "C:\github\django\venv\lib\site-packages\django\test\client.py", line 424, in get
return self.generic(
File "C:\github\django\venv\lib\site-packages\django\test\client.py", line 541, in generic
return self.request(**r)
File "C:\github\django\venv\lib\site-packages\django\test\client.py", line 810, in request
self.check_exception(response)
File "C:\github\django\venv\lib\site-packages\django\test\client.py", line 663, in check_exception
raise exc_value
File "C:\github\django\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\github\django\venv\lib\site-packages\django\core\handlers\base.py", line 220, in _get_response
response = response.render()
File "C:\github\django\venv\lib\site-packages\django\template\response.py", line 114, in render
self.content = self.rendered_content
File "C:\github\django\venv\lib\site-packages\django\template\response.py", line 90, in rendered_content
template = self.resolve_template(self.template_name)
File "C:\github\django\venv\lib\site-packages\django\template\response.py", line 72, in resolve_template
return select_template(template, using=self.using)
File "C:\github\django\venv\lib\site-packages\django\template\loader.py", line 42, in select_template
return engine.get_template(template_name)
File "C:\github\django\venv\lib\site-packages\django\template\backends\django.py", line 34, in get_template
return Template(self.engine.get_template(template_name), self)
File "C:\github\django\venv\lib\site-packages\django\template\engine.py", line 176, in get_template
template, origin = self.find_template(template_name)
File "C:\github\django\venv\lib\site-packages\django\template\engine.py", line 158, in find_template
template = loader.get_template(name, skip=skip)
File "C:\github\django\venv\lib\site-packages\django\template\loaders\cached.py", line 57, in get_template
template = super().get_template(template_name, skip)
File "C:\github\django\venv\lib\site-packages\django\template\loaders\base.py", line 28, in get_template
return Template(
File "C:\github\django\venv\lib\site-packages\django\template\base.py", line 154, in __init__
self.nodelist = self.compile_nodelist()
File "C:\github\django\venv\lib\site-packages\django\template\base.py", line 200, in compile_nodelist
return parser.parse()
File "C:\github\django\venv\lib\site-packages\django\template\base.py", line 514, in parse
self.extend_nodelist(nodelist, compiled_result, token)
File "C:\github\django\venv\lib\site-packages\django\template\base.py", line 531, in extend_nodelist
raise self.error(
django.template.exceptions.TemplateSyntaxError: <ExtendsNode: extends 'blog/base.html'> must be the first tag in the template.
----------------------------------------------------------------------
Ran 1 test in 0.107s
FAILED (errors=1)
Destroying test database for alias 'default'...
뭐가 문제인지 모르겠습니다
목록보기
sungyong 2 years, 6 months ago
에러메시지를 잘 읽어보세요.
django.template.exceptions.TemplateSyntaxError: <ExtendsNode: extends 'blog/base.html'> must be the first tag in the template
템플릿 파일에 에러가 있습니다. 템플릿 파일에서 extends 'blog/base.html' 가 첫번째 태그여야 합니다.
관련 템플릿 파일(html 파일)을 잘 살펴보세요.
소스코드를 볼 수 없어서 저도 말씀드리는데에 한계가 있지만, 현제 에러메시지로 판단할 수 있는 내용은 이렇습니다.
Updated: April 17, 2022, 12:17 p.m.
moonn9389 2 years, 6 months ago
감사합니다
Updated: April 17, 2022, 3:13 p.m.
Leave a Comment: