커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
화성땅 구매하기 post 연습
undefined주차
북마크
이*훈
댓글
5
추천
0
조회수
25
조회수
25
답변 완료

app.py에 db.py 가지고 오는 작업하고 있는데 에러 메세지가 뜨는데 어떻게 해결해야 할까요?


에러 메세지:


Traceback (most recent call last):

 File "/Users/seonghunlee/Desktop/sparta/projects/mars/app.py", line 5, in <module>

  import certifi

ModuleNotFoundError: No module named 'certifi'


파이썬 코드:

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.pr0ksmc.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']

    return jsonify({'msg': 'POST 연결 완료!'})

@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
댓글 알림
나의얼굴