
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
mongodb에 내용이 뜨지 않네요 ㅠㅠ
화성땅 수업중인데, 화성땅 전에 user 만들었을 때도 분명 만들었고, db가 떴었는데 어느날 갑자기 안떴는데...이번에도 영문을 모르겠네요 ㅠㅠ
이건 app.py 코드
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
from pymongo import MongoClient
client = MongoClient('mongodb+srv://sparta:test@cluster0.xmvg6np.mongodb.net/?retryWrites=true&w=majority')
db = client.dbsparta
@app.route('/')
def home():
return render_template('index.html')
@app.route("/mars", methods=["POST"])
def 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 mars_get():
return jsonify({'msg':'GET 연결 완료!'})
if __name__ == '__main__':
app.run('0.0.0.0', port=5000, debug=True)
이건 새터미널에서 실행 눌렀을 때 터미널에 나온 내용인데, winerror가 뭔지 모르겠네요 오류인건지, 무시해도 될까요?
jyy18@DESKTOP-8LGLPUK MINGW64 ~/OneDrive/바탕 화면/Sparta/projects/02.mars $ source "c:/Users/jyy18/OneDrive/바탕 화면/Sparta/projects/02.mars/venv/Scripts/activate" (venv) jyy18@DESKTOP-8LGLPUK MINGW64 ~/OneDrive/바탕 화면/Sparta/projects/02.mars $ "c:/Users/jyy18/OneDrive/바탕 화면/Sparta/projects/02.mars/venv/Scripts/python.exe" "c:/Users/jyy18/OneDrive/바탕 화면/Sparta/projects/02.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.uction WSGI server instead. * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:5000 * Running on http://192.168.219.102:5000 Press CTRL+C to quit * Restarting with stat * Debugger is active! * Debugger PIN: 283-616-051 127.0.0.1 - - [21/Feb/2023 18:26:18] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [21/Feb/2023 18:26:19] "GET /mars HTTP/1.1" 200 - 127.0.0.1 - - [21/Feb/2023 18:26:23] "GET /favicon.ico HTTP/1.1" 404 - 샘플데이터 127.0.0.1 - - [21/Feb/2023 18:26:33] "POST /mars HTTP/1.1" 200 - * Detected change in 'c:\\Users\\jyy18\\OneDrive\\바탕 화면\\Sparta\\projects\\02.mars\\app.py', reloading * Restarting with stat * Debugger is active! * Debugger PIN: 283-616-051 * Detected change in 'c:\\Users\\jyy18\\OneDrive\\바탕 화면\\Sparta\\projects\\02.mars\\app.py', reloading * Restarting with stat * Debugger is active! * Debugger PIN: 283-616-051 127.0.0.1 - - [21/Feb/2023 18:43:07] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [21/Feb/2023 18:43:07] "GET /mars HTTP/1.1" 200 - 127.0.0.1 - - [21/Feb/2023 18:43:36] "POST /mars HTTP/1.1" 200 - * Detected change in 'c:\\Users\\jyy18\\OneDrive\\바탕 화면\\Sparta\\projects\\02.mars\\app.py', reloading Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\jyy18\OneDrive\바탕 화면\Sparta\projects\02.mars\venv\lib\site-packages\werkzeug\serving.py", line 766, in serve_forever super().serve_forever(poll_interval=poll_interval) File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 232, in serve_forever ready = selector.select(poll_interval) File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select r, w, _ = self._select(self._readers, self._writers, [], timeout) File "C:\Users\jyy18\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: 283-616-051 * Detected change in 'c:\\Users\\jyy18\\OneDrive\\바탕 화면\\Sparta\\projects\\02.mars\\app.py', reloading Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\jyy18\OneDrive\바탕 화면\Sparta\projects\02.mars\venv\lib\site-packages\werkzeug\serving.py", line 766, in serve_foreverrkzeug\serving.py", line 766, in serve_forever super().serve_forever(poll_interval=poll_interval) 2, in serve_forever File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 232, in serve_forever in select ready = selector.select(poll_interval) File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in _select in select r, w, _ = self._select(self._readers, self._writers, [], timeout) File "C:\Users\jyy18\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: 283-616-051 * Detected change in 'c:\\Users\\jyy18\\OneDrive\\바탕 화면\\Sparta\\projects\\02.mars\\app.py', reloading Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\jyy18\OneDrive\바탕 화면\Sparta\projects\02.mars\venv\lib\site-packages\werkzeug\serving.py", line 766, in serve_forever super().serve_forever(poll_interval=poll_interval) File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 232, in serve_forever ready = selector.select(poll_interval) File "C:\Users\jyy18\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select r, w, _ = self._select(self._readers, self._writers, [], timeout) File "C:\Users\jyy18\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: 283-616-051

