以下範例是IIS 5.1,並且在已經安裝好Python 2.5的環境下實作的

1.先到控制台

系統管理工具

2008-12-15_115921.jpg

 

2.選擇 IIS

2008-12-15_120004.jpg

3. 到網站下面 預設網站下面按右鍵

2008-12-15_120045.jpg

4. 應用程式設定 選擇設定

2008-12-15_120113.jpg

5. 新增=> 加入Python.exe的路徑 並在後面加上 %s %s

2008-12-15_120134.jpg

6. 測試python可以運作
在wwwroot下面加入test.py

test.py

print
print 'Status: 200 OK'
print 'Content-type: text/html'
print

print '<HTML><HEAD><TITLE>Python Sample CGI</TITLE></HEAD>'
print '<BODY>'
print '<H1>This is a header</H1>'

print '<p>' #this is a comment
print 'See this is just like most other HTML'
print '<br>'
print '</BODY>'

打開IE,輸入網址為http://127.0.0.1/test.py

2008-12-15_133154.png

7. 恭喜你,成功囉

參考來源: http://support.microsoft.com/kb/276494

arrow
arrow
    全站熱搜

    Roddick 發表在 痞客邦 留言(0) 人氣()