
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
4-13강 10:59 부분 진행 중 선생님과 결과가 달라요.
선생님은 기록하기 눌렀을 때 저장완료! 알러트가 나오고 진행이 되는데 저는 홈페이지가 아무 반응이 없어요.
vs코드 터미널에 certificate has expired가 나오는데 무슨 뜻일까요?

현재 강의 따라가면서 app.py에 친 코드
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
client = MongoClient('mongodb+srv://sparta:test@cluster0.wzq1kwb.mongodb.net/?retryWrites=true&w=majority')
db = client.dbsparta
import requests
from bs4 import BeautifulSoup
@app.route('/')
def home():
return render_template('index.html')
@app.route("/movie", methods=["POST"])
def movie_post():
url_receive = request.form['url_give']
comment_receive = request.form['comment_give']
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get(url_receive,headers=headers)
soup = BeautifulSoup(data.text, 'html.parser')
ogtitle = soup.select_one('meta[property="og:title"]')['content']
ogdesc = soup.select_one('meta[property="og:description"]')['content']
ogimage = soup.select_one('meta[property="og:image"]')['content']
doc = {
'title':ogtitle,
'desc':ogdesc,
'image':ogimage,
'comment':comment_receive,
}
db.movies.insert_one(doc)
return jsonify({'msg':'저장완료!'})
@app.route("/movie", methods=["GET"])
def movie_get():
return jsonify({'msg':'GET 연결 완료!'})
if __name__ == '__main__':
app.run('0.0.0.0', port=5000, debug=True)
현재 강의 따라가면서 index.html에 친 코드
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<title>스파르타 피디아</title>
<link href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Gowun Dodum', sans-serif;
}
.mytitle {
width: 100%;
height: 250px;
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://movie-phinf.pstatic.net/20210715_95/1626338192428gTnJl_JPEG/movie_image.jpg');
background-position: center;
background-size: cover;
color: white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.mytitle>button {
width: 200px;
height: 50px;
background-color: transparent;
color: white;
border-radius: 50px;
border: 1px solid white;
margin-top: 10px;
}
.mytitle>button:hover {
border: 2px solid white;
}
.mycomment {
color: gray;
}
.mycards {
margin: 20px auto 0px auto;
width: 95%;
max-width: 1200px;
}
.mypost {
width: 95%;
max-width: 500px;
margin: 20px auto 0px auto;
padding: 20px;
box-shadow: 0px 0px 3px 0px gray;
display: none;
}
.mybtns {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-top: 20px;
}
.mybtns>button {
margin-right: 10px;
}
</style>
<script>
$(document).ready(function () {
listing();
});
function listing() {
fetch('/movie').then((res) => res.json()).then((data) => {
console.log(data)
alert(data['msg'])
})
}
function posting() {
let url = $('#url').val()
let comment = $('#comment').val()
let formData = new FormData();
formData.append("url_give", url);
formData.append("comment_give", comment);
fetch('/movie', { method: "POST", body: formData }).then((res) => res.json()).then((data) => {
alert(data['msg'])
})
}
function open_box() {
$('#post-box').show()
}
function close_box() {
$('#post-box').hide()
}
</script>
</head>
<body>
<div class="mytitle">
<h1>내 생애 최고의 영화들</h1>
<button onclick="open_box()">영화 기록하기</button>
</div>
<div class="mypost" id="post-box">
<div class="form-floating mb-3">
<input id="url" type="email" class="form-control" placeholder="name@example.com">
<label>영화URL</label>
</div>
<div class="form-floating">
<textarea id="comment" class="form-control" placeholder="Leave a comment here"></textarea>
<label for="floatingTextarea2">코멘트</label>
</div>
<div class="mybtns">
<button onclick="posting()" type="button" class="btn btn-dark">기록하기</button>
<button onclick="close_box()" type="button" class="btn btn-outline-dark">닫기</button>
</div>
</div>
<div class="mycards">
<div class="row row-cols-1 row-cols-md-4 g-4" id="cards-box">
<div class="col">
<div class="card h-100">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top">
<div class="card-body">
<h5 class="card-title">영화 제목이 들어갑니다</h5>
<p class="card-text">여기에 영화에 대한 설명이 들어갑니다.</p>
<p>⭐⭐⭐</p>
<p class="mycomment">나의 한줄 평을 씁니다</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top">
<div class="card-body">
<h5 class="card-title">영화 제목이 들어갑니다</h5>
<p class="card-text">여기에 영화에 대한 설명이 들어갑니다.</p>
<p>⭐⭐⭐</p>
<p class="mycomment">나의 한줄 평을 씁니다</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top">
<div class="card-body">
<h5 class="card-title">영화 제목이 들어갑니다</h5>
<p class="card-text">여기에 영화에 대한 설명이 들어갑니다.</p>
<p>⭐⭐⭐</p>
<p class="mycomment">나의 한줄 평을 씁니다</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top">
<div class="card-body">
<h5 class="card-title">영화 제목이 들어갑니다</h5>
<p class="card-text">여기에 영화에 대한 설명이 들어갑니다.</p>
<p>⭐⭐⭐</p>
<p class="mycomment">나의 한줄 평을 씁니다</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
터미널에 나오는 이야기
DONG HYUN LEE@DESKTOP-AE57O4H MINGW64 ~/Desktop/sparta/projects/03.pedia
$ source "c:/Users/DONG HYUN LEE/Desktop/sparta/projects/03.pedia/venv/Scripts/activate"
(venv)
DONG HYUN LEE@DESKTOP-AE57O4H MINGW64 ~/Desktop/sparta/projects/03.pedia
$ "c:/Users/DONG HYUN LEE/Desktop/sparta/projects/03.pedia/venv/Scripts/python.exe" "c:/Users/DONG HYUN LEE/Desktop/sparta/projects/03.pedia/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://192.168.0.4:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 682-164-839
127.0.0.1 - - [13/Jan/2023 16:10:27] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [13/Jan/2023 16:10:27] "GET /movie HTTP/1.1" 200 -
* Detected change in 'c:\\Users\\DONG HYUN LEE\\Desktop\\sparta\\projects\\03.pedia\\app.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 682-164-839
127.0.0.1 - - [13/Jan/2023 16:11:26] "POST /movie HTTP/1.1" 500 -
Traceback (most recent call last):
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 2548, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 2528, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "c:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\app.py", line 35, in movie_post
db.movies.insert_one(doc)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\collection.py", line 628, in insert_one
self._insert_one(
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\collection.py", line 569, in _insert_one
self.__database.client._retryable_write(acknowledged, _insert_command, session)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1475, in _retryable_write
with self._tmp_session(session) as s:
File "C:\Users\DONG HYUN LEE\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1757, in _tmp_session
s = self._ensure_session(session)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1740, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1685, in __start_session
self._topology._check_implicit_session_support()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\topology.py", line 538, in _check_implicit_session_support
self._check_session_support()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\topology.py", line 554, in _check_session_support
self._select_servers_loop(
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\topology.py", line 238, in _select_servers_loop
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: ac-op7pcqo-shard-00-02.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124),ac-op7pcqo-shard-00-00.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124),ac-op7pcqo-shard-00-01.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124), Timeout: 30s, Topology Description: <TopologyDescription id: 63c103ff40a3b387030210f5, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-op7pcqo-shard-00-00.wzq1kwb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-op7pcqo-shard-00-00.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)')>, <ServerDescription ('ac-op7pcqo-shard-00-01.wzq1kwb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-op7pcqo-shard-00-01.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)')>, <ServerDescription ('ac-op7pcqo-shard-00-02.wzq1kwb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-op7pcqo-shard-00-02.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)')>]>
127.0.0.1 - - [13/Jan/2023 16:11:36] "POST /movie HTTP/1.1" 500 -
Traceback (most recent call last):
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 2548, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 2528, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\flask\app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "c:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\app.py", line 35, in movie_post
db.movies.insert_one(doc)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\collection.py", line 628, in insert_one
self._insert_one(
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\collection.py", line 569, in _insert_one
self.__database.client._retryable_write(acknowledged, _insert_command, session)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1475, in _retryable_write
with self._tmp_session(session) as s:
File "C:\Users\DONG HYUN LEE\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1757, in _tmp_session
s = self._ensure_session(session)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1740, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\mongo_client.py", line 1685, in __start_session
self._topology._check_implicit_session_support()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\topology.py", line 538, in _check_implicit_session_support
self._check_session_support()
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\topology.py", line 554, in _check_session_support
self._select_servers_loop(
File "C:\Users\DONG HYUN LEE\Desktop\sparta\projects\03.pedia\venv\lib\site-packages\pymongo\topology.py", line 238, in _select_servers_loop
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: ac-op7pcqo-shard-00-02.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124),ac-op7pcqo-shard-00-00.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124),ac-op7pcqo-shard-00-01.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124), Timeout: 30s, Topology Description: <TopologyDescription id: 63c103ff40a3b387030210f5, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-op7pcqo-shard-00-00.wzq1kwb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-op7pcqo-shard-00-00.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)')>, <ServerDescription ('ac-op7pcqo-shard-00-01.wzq1kwb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-op7pcqo-shard-00-01.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)')>, <ServerDescription ('ac-op7pcqo-shard-00-02.wzq1kwb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-op7pcqo-shard-00-02.wzq1kwb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)')>]>
