
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
질문 app.py에서 port:5001로 접속을하고 이상없이 되었는데 undefined가 뜨나요?
두번째 강의를 돌려보다보니 출력은 이상없이 된것 같읍니다.
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
client = MongoClient('mongodb+srv://test:sparta@cluster0.u02lrhz.mongodb.net/cluster0?retryWrites=true&w=majority')
db = client.dbsparta
@app.route('/')
def home():
return render_template('index.html')
@app.route("/bucket", methods=["POST"])
def bucket_post():
bucket_receive = request.form['bucket_give']
bucket_list = list(db.bucket.find({}, {'_id': False}))
count = len(bucket_list) +1
doc = {
'num':count,
'bucket':bucket_receive,
'done':0
}
db.bucket.insert_one(doc)
return jsonify({'msg': '등록 완료!'})
@app.route("/bucket/done", methods=["POST"])
def bucket_done():
sample_receive = request.form['sample_give']
print(sample_receive)
return jsonify({'msg': 'POST(완료) 연결 완료!'})
@app.route("/bucket", methods=["GET"])
def bucket_get():
bucket_list = list(db.bucket.find({}, {'_id': False}))
return jsonify({'buckets': bucket_list })
if __name__ == '__main__':
app.run('0.0.0.0', port=5001, debug=True)
C:\Users\master-second\Desktop\스파르타\project\buket\venv\Scripts\python.exe C:\Users\master-second\Desktop\스파르타\project\buket\APP.PY
* Serving Flask app 'APP'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5001
* Running on http://172.30.1.13:5001
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 920-892-715

