
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
import certifi
ca = certifi.where();
client = MongoClient(
'mongodb+srv://limjungho:!lim828285@cluster0.fy7rw6j.mongodb.net/cluster0?retryWrites=true&w=majority')
db = client.dbsparta
@app.route('/')
def home():
return render_template('index.html')
@app.route("/mars", methods=["POST"])
def web_mars_post():
name_receive = request.form['name_give']
address_receive = request.form['address_give']
size_receive = request.form['size_give']
doc = {
'name':name_receive,
'address': address_receive,
'size': size_receive
}
db.mars.insert_one(doc)
return jsonify({'msg': '주문 완료!'})
@app.route("/mars", methods=["GET"])
def web_mars_get():
return jsonify({'msg': 'GET 연결 완료!'})
if __name__ == '__main__':
app.run('0.0.0.0', port=5000, debug=True)


dbprac.py에서 아래 코드를 가져온 뒤에 위와 같이 'http://localhost:5000/'에 오류가 발생됩니다.
도와주세요~!
from pymongo import MongoClient
import certifi
ca = certifi.where();
client = MongoClient(
'mongodb+srv://limjungho:!lim828285@cluster0.fy7rw6j.mongodb.net/cluster0?retryWrites=true&w=majority')
db = client.dbsparta
