
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
import certifi
ca = certifi.where()
client = MongoClient('mongodb+srv://test:sparta@cluster0.gzmia1r.mongodb.net/Cluster0?retryWrites=true&w=majority',tlsCAFile=ca)
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)
/Users/user/Desktop/sparta/projects/mars/venv/bin/python /Users/user/Desktop/sparta/projects/mars/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:5000
* Running on http://172.30.1.24:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
127.0.0.1 - - [11/Nov/2022 14:41:54] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [11/Nov/2022 14:41:54] "GET /mars HTTP/1.1" 200 -
데이터전송
127.0.0.1 - - [11/Nov/2022 14:59:12] "POST /mars HTTP/1.1" 200 -
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 111-050-019
* Detected change in '/Users/user/Desktop/sparta/projects/mars/app.py', reloading
* Restarting with stat
Traceback (most recent call last):
File "/Users/user/Desktop/sparta/projects/mars/app.py", line 5, in <module>
import certifi
ModuleNotFoundError: No module named 'certifi'
종료 코드 1(으)로 완료된 프로세스
certifi를 설치했는데도 오ㅠ가 뜨는데 오ㅑㅐ그러는건가요
