
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
새로 고침 하기를 누르면 영화 기록하기 부분의 박스까지는 나오는데 카드 4장부터는 나온 순간 사라져 버립니다 그전엔 그대로 나왔는데 어느 순간부터 안되네요 강의 여러번 듣고 선생님 강의 중 코딩한 부분을 체크 했을 때 다른 부분은 없는 거 같아요 몽고 디비를 처음 이용할 때 안되어 즉문즉답에서 install certifi 가르켜 주어서 그 다음부터는 되었는 데 4주차강의 완료후 부터는 경고가 뜨네요
.png)
작성한 코드 및 에러 메세지
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) => {
let rows=data['result']
$('#cards-box').empty()
rows.forEach((a)=>{
let comment = a['comment']
let title = a['title']
let desc = a['desc']
let image = a['image']
let star = a['star']
let star_repeat = '⭐'.repeat(star)
let temp_html = `<div class="col">
<div class="card h-100">
<img src="${image}"
class="card-img-top">
<div class="card-body">
<h5 class="card-title">${title}</h5>
<p class="card-text">${desc}</p>
<p>${star_repeat}</p>
<p class="mycomment">${comment}</p>
</div>
</div>
</div>`
$('#cards-box').append(temp_html)
})
})
}
function posting() {
let url=$('#url').val()
let comment=$('#comment').val()
let star = $('#star').val()
let formData = new FormData();
formData.append("url_give", url);
formData.append("comment_give", comment);
formData.append("star_give", star);
fetch('/movie', { method: "POST", body: formData }).then((res) => res.json()).then((data) => {
alert(data['msg'])
window.location.reload()
})
}
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="input-group mb-3">
<label class="input-group-text" for="inputGroupSelect01">별점</label>
<select class="form-select" id="star">
<option selected>-- 선택하기 --</option>
<option value="1">⭐</option>
<option value="2">⭐⭐</option>
<option value="3">⭐⭐⭐</option>
<option value="4">⭐⭐⭐⭐</option>
<option value="5">⭐⭐⭐⭐⭐</option>
</select>
</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>
에러메시지
PS C:\Users\user\Desktop\spartr\projects\03.pedia> & c:/Users/user/Desktop/spartr/projects/03.pedia/venv/Scripts/Activate.ps1
(venv) PS C:\Users\user\Desktop\spartr\projects\03.pedia> & c:/Users/user/Desktop/spartr/projects/03.pedia/venv/Scripts/python.exe c:/Users/user/Desktop/spartr/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://175.196.65.81:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 275-638-846
* Detected change in 'c:\\Users\\user\\Desktop\\spartr\\projects\\03.pedia\\app.py', reloading
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\user\Desktop\spartr\projects\03.pedia\venv\lib\site-packages\werkzeug\serving.py", line 766, in serve_forever
super().serve_forever(poll_interval=poll_interval)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 232, in serve_forever
ready = selector.select(poll_interval)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] 소켓 이외의 개체에 작업을 시도했습니다
* Restarting with stat
* Debugger is active!
* Debugger PIN: 275-638-846
127.0.0.1 - - [30/Mar/2023 19:10:49] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Mar/2023 19:10:50] "GET /movie HTTP/1.1" 200 -
127.0.0.1 - - [30/Mar/2023 19:10:50] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [30/Mar/2023 19:12:26] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Mar/2023 19:12:26] "GET /movie HTTP/1.1" 200 -
45.79.172.21 - - [30/Mar/2023 19:19:55] code 400, message Bad request version ('À\x14À')
45.79.172.21 - - [30/Mar/2023 19:19:55] "
ÿq
§ið>+ÞkWã¿ã
server.py", line 232, in serve_forever
ready = selector.select(poll_interval)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] 소켓 이외의 개체에 작업을 시도했습니다
* Restarting with stat
* Debugger is active!
* Debugger PIN: 275-638-846
127.0.0.1 - - [30/Mar/2023 19:10:49] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Mar/2023 19:10:50] "GET /movie HTTP/1.1" 200 -
127.0.0.1 - - [30/Mar/2023 19:10:50] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [30/Mar/2023 19:12:26] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Mar/2023 19:12:26] "GET /movie HTTP/1.1" 200 -
45.79.172.21 - - [30/Mar/2023 19:19:55] code 400, message Bad request version ('À\x14À')
45.79.172.21 - - [30/Mar/2023 19:19:55] "
ÿq
§ið>+ÞkWã¿ã
Û`W¦<Ë/À0À+À,̨̩ÀÀ ÀÀ" HTTPStatus.BAD_REQUEST -
45.79.168.172 - - [30/Mar/2023 19:32:34] "GET / HTTP/1.1" 200 -
* Detected change in 'c:\\Users\\user\\Desktop\\spartr\\projects\\03.pedia\\app.py', reloading
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\user\Desktop\spartr\projects\03.pedia\venv\lib\site-packages\werkzeug\serving.py", line 766, in serve_forever
super().serve_forever(poll_interval=poll_interval)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 232, in serve_forever
ready = selector.select(poll_interval)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] 소켓 이외의 개체에 작업을 시도했습니다
* Restarting with stat
* Debugger is active!
* Debugger PIN: 275-638-846
오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.
Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
