-Base.html 구성
<!DOCTYPE html>
<html lang="ko">
{% include 'head.html' %}
<body>
{% include 'header.html' %}
{% block content %}
{% endblock %}
{% include 'footer.html' %}
</body>
</html>
inclued는 다른 template를 import하는 개념으로 이해하면 됨
-Header.html은 상단바에 대한 내용
-footer.html은 하단바에 대한 내용
accountapp 앱 내의 templates에 hello_world.html-->
{% extends 'base.html' %}
{% block content%}
<div style="height: 20rem; background-color: azure; border-radius: 1rem; margin: 2rem;">
<h1>testing</h1>
</div>
{% endblock %}
-{block content} ~ {endblock} 사이에 코드 작성 -->base.html이 씌어지고 그 사이에 작성된 코드들이 적용됨
accountapp내 views.py-->
def hello_world(request):
return render(request, 'accountapp/hello_world.html')
-accountapp내의 hello_world.html을 실행시킴
models.py class 작성 (14강) (0) | 2021.07.15 |
---|---|
static 설정(11강) (0) | 2021.07.15 |
부트스트랩 적용 (10강) (0) | 2021.07.15 |
templates내용 뜨게 하기(pinterest clone 8강) (0) | 2021.07.14 |
django project 시작(pinterest clone 5강) (0) | 2021.07.14 |
댓글 영역