커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
사이트에 연결할수 없음
undefined주차
북마크
손*아
댓글
10
추천
0
조회수
16
조회수
16
답변 완료

localhost와 연결이 안됩니다 ..ㅠㅠ 이게 안되서 다삭제하고 처음부터 다시했는데 똑같네요..!

from flask import Flask, render_template, request, jsonify
app = Flask(__name__)

from pymongo import MongoClient
client = MongoClient('mongodb+srv://son-gyeong-ah:Rhddk114@cluster0.jduknc6.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 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)

취소
 공유
취소
댓글 0
댓글 알림
나의얼굴