
강의 내용대로 따라하고 있었는데요.
app.py에서 실행을 하면
(venv)
Tail@DESKTOP-FKN4A2V MINGW64 ~/Desktop/sparta/projects/02.mars
$ c:/Users/Tail/Desktop/sparta/projects/02.mars/venv/Scripts/python.exe c:/Users/Tail/Desktop/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.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://192.168.0.14:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 988-380-404
이렇게 워닝이 뜨고,
localhost:5000 연결이 안 됩니다.
app.py 코드스니펫 붙여 넣은 내용입니다.
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route("/mars", methods=["POST"])
def mars_post():
sample_receive = request.form['sample_give']
print(sample_receive)
return jsonify({'msg':'POST 연결 완료!'})
@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)
