zoukankan      html  css  js  c++  java
  • iis部署python运行环境

    IIS部署

    1.启用或者关闭windows功能,选择安装CGI,我这里已经安装过了。

     2.安装后重新打开IIS看到CGI

    3.配置ISAPI和CGI限制

     4.右上角添加,路径是python安装路径,注意要加上两个 %s %s

    点确定

    5.处理映射关系

    6.右上角  添加模块,模块选择:CgiModule 

    出现弹出框,点“是”

    添加完成

     

    7.接下来测试一下,创建一个网站

     

    服务器端测试代码:

     1 #!/usr/bin/python
     2 import cgi
     3 import json
     4 #!/usr/bin/python
     5 # print ("Content-Type: text/html")
     6 # print ("")
     7 # print ("<html>")
     8 # print ("<h2>CGI Script Output</h2>")
     9 # print ("<p>This page was generated by a Python CGI script.</p>")
    10 # print ("</html>")
    11 def main(): 
    12     print ("Content-type: text/html
    ")
    13     form = cgi.FieldStorage()
    14     print(form.keys())
    15     print(type(form))
    16     if form.keys() and form["ServiceCode"].value != "":
    17         print ("<h1> Hello",form["ServiceCode"].value,"</h1>" )
    18 
    19     else:   
    20         print ("<h1> Error! Please enter first name.</h1>")
    21 main()

     测试OK!

  • 相关阅读:
    hdu 2295 DLX
    hdu 4714 树形DP
    hdu 4711 动态规划
    hdu 3656 DLX
    hust 1017 DLX
    hdu 3938 并查集
    hdu 3652 打表
    poj 2152 树形DP
    洛谷P1266速度限制
    洛谷P1841重要的城市
  • 原文地址:https://www.cnblogs.com/shenh/p/8028081.html
Copyright © 2011-2022 走看看