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!

  • 相关阅读:
    博客园样式设置
    最坏情况为线性时间的选择算法
    棋盘覆盖
    矩阵乘法的Strassen算法及时间复杂度
    大整数乘法及算法时间复杂度
    全排列问题的递归算法(Perm)
    python的lambda
    python的zip函数
    python操作队列
    mysql基础命令
  • 原文地址:https://www.cnblogs.com/shenh/p/8028081.html
Copyright © 2011-2022 走看看