T.I.L (팀 프로젝트 피드백 해결과정 - 1)
2023. 3. 20. 18:52ㆍT.I.L (Today_I_Learned)
피드백
- 플라스크 함수 5개 썼는데 하나만 사용해서 같은 결과가 나오게끔 고민해 보세요.
내가 시도해 본 것들
#팀장님 소개페이지
@app.route("/1/<id>", methods=["GET"])
def detail_kgh_get(id):
teamlist = db.team.find_one({'name': id}, {'_id': False})
reviews = list(db.reviewlist.find({'name':id},{'_id':False}))
print(teamlist, reviews)
return render_template('index_introduce_kgh.html', data=teamlist, data1 = reviews)
#팀원1님 소개페이지
@app.route("/2/<id>", methods=["GET"])
def detail_mdh_get(id):
teamlist = db.team.find_one({'name': id}, {'_id': False})
reviews = list(db.reviewlist.find({'name':id},{'_id':False}))
print(teamlist, reviews)
return render_template('index_introduce_mdh.html', data=teamlist, data1 = reviews)
#팀원2님 소개페이지
@app.route("/3/<id>", methods=["GET"])
def detail_lsm_get(id):
teamlist = db.team.find_one({'name': id}, {'_id': False})
reviews = list(db.reviewlist.find({'name':id},{'_id':False}))
print(teamlist, reviews)
return render_template('index_introduce_lsm.html', data=teamlist, data1 = reviews)
#팀원3님 소개페이지
@app.route("/4/<id>", methods=["GET"])
def detail_ijh_get(id):
teamlist = db.team.find_one({'name': id}, {'_id': False})
reviews = list(db.reviewlist.find({'name':id},{'_id':False}))
print(teamlist, reviews)
return render_template('index_introduce_ijh.html', data=teamlist, data1 = reviews)
#팀원4님 소개페이지
@app.route("/5/<id>", methods=["GET"])
def detail_hsy_get(id):
teamlist = db.team.find_one({'name': id}, {'_id': False})
reviews = list(db.reviewlist.find({'name':id},{'_id':False}))
print(teamlist, reviews)
return render_template('index_introduce_hsy.html', data=teamlist, data1 = reviews)
현재는 위와 같이 팀원 다섯명의 페이지를 다 따로 지정해서 GET을 하였습니다.
해결
아직은 해결 방법을 더 찾아봐야 할 것 같습니다.
새롭게 알게 된 것
내가 복잡한데? 라고 느낄 정도면 이미 간단하게 만들 해결책이 분명히 있다는 것을 느꼈습니다.
꼭 방법을 찾아내고 말겠습니다!
'T.I.L (Today_I_Learned)' 카테고리의 다른 글
T.I.L (Python if문(조건문)) (0) | 2023.03.24 |
---|---|
T.I.L (딕셔너리) (0) | 2023.03.22 |
T.I.L (Python의 자료형 선언) (1) | 2023.03.21 |
T.I.L (Python 맛보기 문제) (2) | 2023.03.20 |
T.I.L (팀 프로젝트 피드백 해결과정 - 2) (2) | 2023.03.20 |