
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
4주차 6강 [화성땅 공동구매] 강의를 듣고 있습니다.
툴은 vs code로 하고 있습니다. 문제는 http://localhost:5000/에 mars>app.py가 연결(?)이 되어야 하는데 계속 prac>app.py가 연결되어 있어서요.
혹시 몰라서 기존에 prac>app.py연결했던 방식대로 mars 폴더에서도 터미널 열고 python -m venv env, python 인터프리터 설정, python3 -m pip install --upgrade pip / python3 -m pip install flask .. 이런 거 다 했는데 localhost:5000에서는 계속 prac을 불러옵니다..
prac>app.py도, mars>app.py도 port=5000에 연결돼 있어서 그런 것 같은데(?), mars>app.py를 포트에 연결시켜서 localhost:5000페이지에 띄우려면 어떻게 해야 하나요?.. 구글링도 해 봤는데 제가 미진한 탓에 해결법을 못 찾고 있습니다..
(참고로 "port 5000 is in use by another program." 이 문제는 아닙니다.. terminal에 오류 없고 airplay 수신 모드 off예요!)
(mars 에서 termianl 열어서 flask run도 해 보고 run&debug도 해 봤는데 계속 prac게 나옵니다!..)
현재 폴더 트리는 아래와 같고요. templates에 index.html 들어가 있습니다!

mars>app.py , mars>templates>index.html 두 파일 내용은 모두 코드스니펫 복붙한 거고 제가 따로 건드린 건 없습니다.
prac>aap.py 코드는 바로 아래와 같습니다.
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
@app.route('/') #http://localhost:5000/
def home():
return render_template('index.html')
@app.route('/test', methods=['GET'])
def test_get():
title_receive = request.args.get('title_give')
#title_give라는 이름으로 뭔가를 get해서 그걸 변수 title_receive에 넣고
print(title_receive)
#Print했어
return jsonify({'result':'success', 'msg': '이 요청은 GET!'})
@app.route('/test', methods=['POST'])
def test_post():
title_receive = request.form['title_give']
print(title_receive)
return jsonify({'result':'success', 'msg': '요청을 잘 받았어요!'})
if __name__ == '__main__':
app.run('0.0.0.0',port=5000,debug=True)
