
DB에 POST까지는 했는데 GET 함수를 썼는데 에러 메세지가 나오고 콘솔에 기록이 안 됩니다.
아무리 다시 봐도 코드가 어디인지 모르겠는데 혹시 도와주실 수 있을까요? ㅜㅜ


사용한 코드입니다.
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
import certifi
ca = certifi.where()
client = MongoClient('mongodb+srv://test:sparta@cluster0.kcdemw8.mongodb.net/Cluster0?retryWrites=true&w=majority', tlsCAFile=ca)
db = client.dbsparta
@app.route('/')
def home():
return render_template('index.html')
@app.route("/homework/done", methods=["POST"])
def homework_post():
name_receive = request.form['name_give']
comment_receive = request.form['comment_give']
doc = {
'name': name_receive,
'comment':comment_receive
}
db.homework.insert_one(doc)
return jsonify({'msg':'응원 완료!'})
@app.route("/homework", methods=["GET"])
def homework_get():
comment_list = list(db.homework.find({},{'_id':False}))
return jsonify({'comment':'comment_list'})
if __name__ == '__main__':
app.run('0.0.0.0', port=5000, debug=True)
