from flask import Flask,render_template,request,jsonify,redirect
from pymongo import MongoClient
client = MongoClient("mongodb+srv://sparta:test@cluster0.wu64ps9.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0")
db=client.d_bar
app = Flask(__name__)
@app.route("/",methods=["GET"])
def index():
mv_list= list(db.mv.find({},{"_id":False}))
# print(mv_list)
return render_template(
"home.html",
lists=mv_list,
title="리스트")
if __name__ == "__main__":
app.run(debug=True,port=5000)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}}</title>
</head>
<body>
{% for list in lists%}
<br>
{{ list.date }}
{{list.mv_name}}
{{list.port_name}}
{{list.cago_name}}
{{list.agnecy_name}}
{{list.remark}}
</br>
{% endfor %}
</body>
</html>