clone coding

    [pinterest clone (6)] html (include / extends)

    base.html 에서 head를 잘라내고 templates/head.html을 새로 만들었다. head.html base.html {% include 'head.html' %} 1 2 3 {% include 'head.html' %} 이게 include 구문이다. 이런식이면 vue의 component랑 비스무리?하게 쓸 수 있을거 같다. runserver에서 봐도 잘 나타난다. 1 header랑 footer는 계속 재활용할거니까 include로 빼주자. : header.html, footer.html 만들어빼고 include로 넣어주기 {% include 'head.html' %} {% include 'header.html' %} {% include 'footer.html' %} 2 header, fo..

    [pinterest clone (5)] Django template과 Views 연결

    extends / include 잘 모르겠는데 뭔가 extends로 바탕을 만들고 include로 내용을 채워넣는 느낌인거 같다. 그렇게 해서 이제 양쪽에 extends와 include를 모두 포함한 결과물이 요청을 받았을때 되돌려줄 response view가 된다. 우선 만들어본다. 1. platypus/templates 폴더 만들기 2. 밑에 루트가될 base.html 만든다. * base가 templates 안에 있으므로써 accountapp에서 view.py에서 응답을 해줄때 여기서 template을 가져와서 그 안에 내용을 박아넣을 수 있는 형태로 쓸 수 있다. 3. views.py from django.http import HttpResponse from django.shortcuts impo..

    [pinterest clone (3)] Accountapp

    1. python manage.py startapp accountapp (account보다 accountapp 이런식으로 이름 정확히붙이는거 좀 괜찮은 방식인거같음. 앞으로 이렇게 굳혀야겠다) 2. platypus/settings.py에 accountapp을 INSTALLED_APPS에 추가 3. 브라우저에서 어떤 경로로 접속하게 되면 그 경로에서 헬로월드 같은 기본 출력해주는 view만들어보자 from django.http import HttpResponse def hello_world(request): return HttpResponse('Hello world!') request 넣으면 주소로 헬로월드 돌려주고 끝! 4. 라우팅 만든 뷰를 보기 위해서는 뷰로 연결을 시켜주는게 필요하다. -> 라우팅 ..

    [pinterest clone (2)] Pycharm setup

    duckracoon.tistory.com/2 django 설치와 더불어 참고. [Django Tutorial] Blog 만들기 (1) Django skeleton 만들기 MVT 순서에 따라서 settings.py, (M) models.py, urls.py, (V) views.py, (T) templates 를 만든다. (1) Pycharm에 django 설치 File > settings > project: backend > python interpreter.. duckracoon.tistory.com 1. platypus project를 만들었다., (* 가상환경 추가할것) 2. django 설치 : pip install django * pip list 로 설치된 라이브러리를 확인할 수 있다. * dja..