Http Server

Http Server: http.server 모듈 이용

실습: Python Flask를 사용하여 GET/POST 요청

1. Python Flask이용 Web server 제작

  • flask server 만들기: flask_server.py

  • flask server 파일 실행

  • "localhost:5000" 로 접속

2. template 파일 제작

  • app.py: flask의 render_template에 의해서 template 디렉토리에 존재하는 html파일을 리턴

  • template파일인 get.html, post.html은 template디렉토리 안에 있어야 함

3. 결과 - GET method

  • flask 파일 app.py 실행

  • "localhost:5000/test_get으로 접속

  • "hello"입력 후 Send Info 버튼 클릭