[ 항해99] 2일차 Website project
IT/Bootcamp 항해992021. 6. 8. 16:23
항해 99
2일차 :
목요일까지 웹사이트를 만들어야한다.
1일차 부터 팀원들이 폭주하여 2시까지 잠을안자고 공부를하신다. 눈치 보면서 새벽까지 웹플러스 강의 듣고
자기전에 jinja2 이용해서 template inheritance사용해서 프로젝트 시작을 해봣다.
https://di-story.tistory.com/12
어저께 팀장님이 SA낸거 말도없이 가져옴.
새로 배운것:
1.
Naver API쓰기
이게 ajax로 받아올려고했는데 서버사이드에서만?할수있다고해서 app.py 에서 돌릴수있다는것같다(?)
@app.route('/search/<keyword>', methods=['GET'])
def search(keyword):
r = requests.get(f"https://openapi.naver.com/v1/search/movie.json?query={keyword}&display=20", headers={ "X-Naver-Client-Id": "ㅁㅁㅁ",
"X-Naver-Client-Secret": " ㅁㅁㅁ"})
result = r.json()
print(result)
item = result.items
print(item)
print("test")
print(keyword)
return render_template('search.html', word = keyword, result=result)
2. jinaja로 가져와서 html에붙여주기
여기서도 거의 두시간넘게 못해서 막혀있엇다...
<div class="container">
{% for item in result['items'] %}
<div class="container">
<h1 id="word" style="display: inline;"> {{ item.title }} </h1>
<div class="box-wrap">
<div class="box" >
<div>
<img src="{{item.image}}" style=" width: 220px; height: 320px" />
</div>
<button type="button" class="btn btn-secondary"> 추가하기
<i class="fa fa-plus" aria-hidden="true"></i></button>
<button type="button" class="btn btn-secondary"> 자세히 보기
<i class="fa fa-search" aria-hidden="true"></i></button>
</div>
<div class="box" >
<h3 id="word" style="display: inline;"> 출시년도 : {{ item.pubDate}} </h3>
<hr>
<h3 id="word" style="display: inline;"> 감독: {{ item.director}} </h3>
<hr>
<h4 id="word" style="display: inline;"> 배우 :{{ item.actor}} </h4>
</div>
</div>
</div>
{% endfor %}
반응형
'IT > Bootcamp 항해99' 카테고리의 다른 글
[ 항해99] 부트캠프 4일차 Web project (0) | 2021.06.11 |
---|---|
[ 항해99] 부트캠프 3일차 Web project (0) | 2021.06.10 |
[ 항해99] 1일차 Website project (0) | 2021.06.08 |
[항해99] 06/3 사전과제 / 준비 웹개발종합반3주차 (0) | 2021.06.06 |
[항해99] 06/3 사전과제 / 준비 웹개발종합반2주차 (0) | 2021.06.04 |
댓글()