Windows를 실행하는 컴퓨터에서 IIS를 설치하고 Python CGI 기능을 활성화하는 방법을 알아보시겠습니까? 이 자습서에서는 IIS 서버에서 Python CGI 기능을 활성화하는 방법을 보여 드리겠습니다.
• Windows 2012 R2
• Windows 2016
• Windows 2019
• Python 3
• IIS
윈도우 자습서 :
이 페이지에서는 Windows 자습서 목록에 빠르게 액세스할 수 있습니다.
튜토리얼 윈도우 – IIS 설치
서버 관리자 응용 프로그램을 엽니다.
관리 메뉴에 액세스하고 역할 및 기능 추가를 클릭합니다.

서버 역할 화면에서 웹 서버 IIS라는 옵션을 선택합니다.
다음 버튼을 클릭합니다.

다음 화면에서 기능 추가 단추를 클릭합니다.

기능 화면에서 다음 단추를 클릭합니다.

역할 서비스 화면에서 다음 단추를 클릭합니다.

요약 화면에서 설치 버튼을 클릭합니다.

축! Windows를 실행하는 컴퓨터에서 IIS 서비스 설치를 완료했습니다.
튜토리얼 IIS – CGI 기능 사용
서버 관리자 응용 프로그램을 엽니다.
관리 메뉴에 액세스하고 역할 및 기능 추가를 클릭합니다.

서버 역할 화면에서 웹 서버 IIS라는 항목을 확장합니다.
응용 프로그램 개발 메뉴에 액세스하고 명명된 옵션을 선택합니다: CGI
다음 버튼을 클릭합니다.

기능 화면에서 다음 단추를 클릭합니다.

요약 화면에서 설치 버튼을 클릭합니다.

축! IIS에서 CGI 기능 설치를 완료했습니다.
튜토리얼 윈도우 – 파이썬 설치
파이썬 웹 사이트에 액세스하고 파이썬 설치 프로그램의 최신 버전을 다운로드합니다.
우리의 예에서, 우리는 라는 파일을 다운로드: 파이썬-3.8.4-amd64.exe

관리자로서 파이썬 설치를 시작합니다.

화면 하단에 있는 두 확인란을 모두 선택합니다.
버튼을 클릭하여 파이썬 설치를 사용자 지정합니다.

모든 확인란을 선택하고 다음 단추를 클릭합니다.

명명된 확인란을 선택합니다: 모든 사용자에 대해 설치합니다.
파이썬 설치 경로를 드라이브 C 루트로 변경합니다.
다음 버튼을 클릭합니다.

파이썬 설치가 완료될 때까지 기다립니다.

우리의 예에서, 파이썬은 다음 디렉터리에 설치되었습니다.
컴퓨터를 재부팅합니다.
축! 당신은 윈도우에서 파이썬 설치를 완료했습니다.
튜토리얼 IIS – IIS 서버에서 파이썬 사용
IIS 관리자라는 응용 프로그램을 시작합니다.

IIS 관리자 응용 프로그램에서 IIS 서버 이름을 선택합니다.
화면의 오른쪽 부분에서 라는 옵션에 액세스합니다.

명명된 옵션 선택: 스크립트 맵 추가

다음 구성을 수행합니다.
• Request Path – *.py
• Executable – C:\Python\Python38\python.exe %s %s
• Interpreter – Python Interpreter
확인 버튼을 클릭합니다.

다음 메시지가 표시되면 예 버튼을 클릭합니다.

IIS 서비스를 다시 시작합니다.
축! IIS 서버에서 파이썬을 성공적으로 활성화했습니다.
튜토리얼 IIS – 파이썬 페이지 만들기
새 DOS 명령줄 프롬프트를 시작합니다.

PIP 응용 프로그램을 사용하여 ART라는 파이썬 라이브러리를 설치합니다.
예제에서는 이 라이브러리를 사용하여 테스트 페이지를 만들 것입니다.
IIS 루트 디렉터리에 액세스합니다.
파이썬 테스트 페이지를 만듭니다.
메모장 응용 프로그램을 사용하여 파이썬 테스트 페이지를 엽니다.
콘텐츠를 다음 코드로 바꿉니다.
브라우저를 열고 웹 서버의 IP 주소와 /test.py 입력합니다.
이 예제에서는 브라우저에 다음 URL을 입력했습니다.
• http://172.31.7.220/test.py
Python 페이지에다음 메시지가 표시되어야 합니다.

축! 파이썬 확장은 IIS에 성공적으로 설치되었습니다.