[ 항해99] 2일차 Website project

IT/Bootcamp 항해99|2021. 6. 8. 16:23

 


항해 99

 

2일차 :

 

목요일까지 웹사이트를 만들어야한다.

 1일차 부터 팀원들이 폭주하여 2시까지 잠을안자고 공부를하신다. 눈치 보면서 새벽까지 웹플러스 강의 듣고 

자기전에 jinja2 이용해서 template inheritance사용해서 프로젝트 시작을 해봣다.

 

https://di-story.tistory.com/12

 

항해01~04_CH.1_미니 프로젝트_S.A.(Starting Assignment)

20조 - 김수연, 방민수, 이동민, 최지혁 1. 프로젝트 제목 MovieTALK(무비톡) 2. 간단 설명 재미있는 영화, 좋아하는 영화를 추천하고 다른 사람들과 함께 나누는 공간입니다. 영화를 골라주시면, 영화

di-story.tistory.com

어저께 팀장님이 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 %}
반응형

댓글()