
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
맥이구요 ,
certifi 설치하고 5001로 바꾸고
몽고디비 주소로 연결 했는데
localhost:5001 안되요..
제가 놓친게 있을까요 ?
import certifi
from pymongo import MongoClient
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
ca = certifi.where()
client = MongoClient(
'mongosh "mongodb+srv://cluster0.lvkmmuk.mongodb.net/myFirstDatabase" --apiVersion 1 --username sparta', tlsCAFile=ca)
db = client.dbsparta
doc = {
'name': 'bob',
'age': 27
}
db.users.insert_one(doc)
@app.route('/')
def home():
return render_template('index.html')
@app.route("/bucket", methods=["POST"])
def bucket_post():
sample_receive = request.form['sample_give']
print(sample_receive)
return jsonify({'msg': 'POST 연결 완료!'})
@app.route("/bucket", methods=["GET"])
def bucket_get():
return jsonify({'msg': 'GET 연결 완료!'})
if __name__ == '__main__':
app.run('0.0.0.0', port=5001, debug=True)

