
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
에러 내용이 mongodb 연결과 관련해서 ssl(?) 문제같은데. 제가 내용을 몰라서 어떻게 고쳐야 하는지 모르겠습니다.
또한 시작과 함께
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:8080
이 warning은 왜 나오나요?
똫나
작성한 코드 및 에러 메세지
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script>
<title>오늘의 전시</title>
<style>
html, body, h1, h2, h3, p, a, span {
margin: 0;
padding: 0;
}
.wrap {
width: 1050px;
margin: auto;
}
.card {
width: 320px;
height: 340px;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content:flex-start;
margin: 16px 10px;
border: 1px solid black;
}
.card-wrap {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.card > span {
margin: 8px;
}
.card-title {
font-size: 18px;
font-weight: bold;
}
.period {
font-size: 14px;
}
.tags {
color: gray ;
font-size: 14px;
word-break: keep-all;
}
.url-form {
align-items: center;
justify-content:space-around ;
}
.plus-form {
align-items: center;
justify-content:center;
cursor: pointer;
}
.card-image {
background-image: url('https://movie-phinf.pstatic.net/20210715_95/1626338192428gTnJl_JPEG/movie_image.jpg');
background-position: center;
background-size: cover;
width: 100%;
height: 200px;
}
</style>
<script>
$(document).ready(() => {
showPlusForm();
})
const showUrlForm = () => {
$('#plus-form').hide()
$('#url-form').show()
}
const showPlusForm = () => {
$('#url-form').hide()
$('#plus-form').show()
}
const posting = () => {
let url = $('#url').val();
// print("###################")
// print(url)
// print("###################")
let formData = new FormData()
formData.append("url_give", url)
fetch('/exhibit', {method: "POST", body: formData}).then(res => res.json()).then(data => {
alert(data['msg']);
window.location.reload();
})
}
</script>
</head>
<body>
<div class="wrap">
<h1>오늘의 전시</h1>
<div class="card-wrap">
<div class="card">
<div class="card-image" ></div>
<span class="card-title"> 제목</span>
<span class="period"> 기간</span>
<span class="tags "> 설명회설명회설명회설명회설명회설명회설명회설명회 설명회설명회설명회</span>
</div>
<div id="url-form" class="url-form card">
<input id="url" placeholder="전시 URL을 입력해 주세요!">
<div>
<button onclick="showPlusForm()">취소하기</button>
<button onclick="posting()">등록하기</button>
</div>
</div>
<div id="plus-form" onclick="showUrlForm()" class="plus-form card">
<span>+</span>
<span>추가하기</span>
</div>
</div>
</div>
</body>
</html>
# app.py
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script>
<title>오늘의 전시</title>
<style>
html, body, h1, h2, h3, p, a, span {
margin: 0;
padding: 0;
}
.wrap {
width: 1050px;
margin: auto;
}
.card {
width: 320px;
height: 340px;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content:flex-start;
margin: 16px 10px;
border: 1px solid black;
}
.card-wrap {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.card > span {
margin: 8px;
}
.card-title {
font-size: 18px;
font-weight: bold;
}
.period {
font-size: 14px;
}
.tags {
color: gray ;
font-size: 14px;
word-break: keep-all;
}
.url-form {
align-items: center;
justify-content:space-around ;
}
.plus-form {
align-items: center;
justify-content:center;
cursor: pointer;
}
.card-image {
background-image: url('https://movie-phinf.pstatic.net/20210715_95/1626338192428gTnJl_JPEG/movie_image.jpg');
background-position: center;
background-size: cover;
width: 100%;
height: 200px;
}
</style>
<script>
$(document).ready(() => {
showPlusForm();
})
const showUrlForm = () => {
$('#plus-form').hide()
$('#url-form').show()
}
const showPlusForm = () => {
$('#url-form').hide()
$('#plus-form').show()
}
const posting = () => {
let url = $('#url').val();
// print("###################")
// print(url)
// print("###################")
let formData = new FormData()
formData.append("url_give", url)
fetch('/exhibit', {method: "POST", body: formData}).then(res => res.json()).then(data => {
alert(data['msg']);
window.location.reload();
})
}
</script>
</head>
<body>
<div class="wrap">
<h1>오늘의 전시</h1>
<div class="card-wrap">
<div class="card">
<div class="card-image" ></div>
<span class="card-title"> 제목</span>
<span class="period"> 기간</span>
<span class="tags "> 설명회설명회설명회설명회설명회설명회설명회설명회 설명회설명회설명회</span>
</div>
<div id="url-form" class="url-form card">
<input id="url" placeholder="전시 URL을 입력해 주세요!">
<div>
<button onclick="showPlusForm()">취소하기</button>
<button onclick="posting()">등록하기</button>
</div>
</div>
<div id="plus-form" onclick="showUrlForm()" class="plus-form card">
<span>+</span>
<span>추가하기</span>
</div>
</div>
</div>
</body>
</html>
# python app.py 실행후 에러 메세지
python 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 http://127.0.0.1:8080
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 109-233-457
127.0.0.1 - - [01/May/2023 15:54:38] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/May/2023 15:55:34] "POST /exhibit HTTP/1.1" 500 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flask/app.py", line 2213, in __call__
return self.wsgi_app(environ, start_response)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flask/app.py", line 2193, in wsgi_app
response = self.handle_exception(e)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/Users/sunwookkim/Dropbox/ChunKiNuSeol/CHATGPT/SpartaCoding/WebDesign/WebCode/pirates/app.py", line 46, in post_exhibit
db.exhibition.insert_one(doc)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/collection.py", line 628, in insert_one
self._insert_one(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/collection.py", line 569, in _insert_one
self.__database.client._retryable_write(acknowledged, _insert_command, session)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1475, in _retryable_write
with self._tmp_session(session) as s:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1757, in _tmp_session
s = self._ensure_session(session)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1740, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1685, in __start_session
self._topology._check_implicit_session_support()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/topology.py", line 538, in _check_implicit_session_support
self._check_session_support()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/topology.py", line 554, in _check_session_support
self._select_servers_loop(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymongo/topology.py", line 238, in _select_servers_loop
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: ac-vbphdyo-shard-00-00.l5rqkgp.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129),ac-vbphdyo-shard-00-02.l5rqkgp.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129),ac-vbphdyo-shard-00-01.l5rqkgp.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129), Timeout: 30s, Topology Description: <TopologyDescription id: 644f622bcb865d5128eb5c60, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-vbphdyo-shard-00-00.l5rqkgp.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-vbphdyo-shard-00-00.l5rqkgp.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')>, <ServerDescription ('ac-vbphdyo-shard-00-01.l5rqkgp.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-vbphdyo-shard-00-01.l5rqkgp.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')>, <ServerDescription ('ac-vbphdyo-shard-00-02.l5rqkgp.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-vbphdyo-shard-00-02.l5rqkgp.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')>]>
