python - Web11
python flask
1. /의 여부
@app.route('/pro')
def home():
return 'hello world3'
@app.route('/pro2/')
def home2():
return 'hello world3'
전체코드
from flask import Flask
app = Flask(__name__)
@app.route('/pro')
def home():
return 'hello world3'
@app.route('/pro2/')
def home2():
return 'hello world3'
if __name__ == '__main__':
app.run(debug=True)
실행 화면
1. http://127.0.0.1:5000/pro2. http://127.0.0.1:5000/pro/
3. http://127.0.0.1:5000/pro2/
http://127.0.0.1:5000/pro2 를 주소창에 입력해도 자동으로 http://127.0.0.1:5000/pro2/ 로 이동한다.
댓글
댓글 쓰기