
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
터미널에 따로 오류는 안뜨는데 localhost:5001이 아무것도 뜨지 않습니다.
<터미널>
(venv) dana@ida-eun-ui-MacBookAir 04.bucket % /Users/dana/Desktop/SPARTA/Projects/04.bucket/venv/bin/python /Users/dana/Desktop/SPARTA/Projects/04.bucket/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://192.168.100.12:5001
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 649-627-530
127.0.0.1 - - [03/May/2023 15:00:16] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2023 15:00:47] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2023 15:00:48] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2023 15:00:49] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2023 15:00:49] "GET / HTTP/1.1" 200 -
* Detected change in '/Users/dana/Desktop/SPARTA/Projects/04.bucket/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 649-627-530
127.0.0.1 - - [03/May/2023 15:01:02] "GET / HTTP/1.1" 200 -

작성한 코드 및 에러 메세지
이건 작성한 코드에요!
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
import certifi
ca = certifi.where()
client = MongoClient('mongodb+srv://sparta:test@cluster0.gduomvk.mongodb.net/?retryWrites=true&w=majority', tlsCAFile=ca)
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']
doc = {
'bucket': bucket_receive
}
db.bucket.insert_one(doc)
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)
