当前位置: 首页 > news >正文

滨州网站建设电话服装企业网站源码

滨州网站建设电话,服装企业网站源码,网站建设主要有哪些成本,团购网站销售技巧uWSGI的安装就不多说了、不懂的参考前面的文章、以下例子都是以http的形式来启动、比如莪的py文件名称叫做return_enviorn.py、那么便是这么来执行、如果迩想查看效果、请打开http://hostip:9090来查看 ./uwsgi --http :9090 --wsgi-file ../program/py_script/return_enviorn.…uWSGI的安装就不多说了、不懂的参考前面的文章、以下例子都是以http的形式来启动、比如莪的py文件名称叫做return_enviorn.py、那么便是这么来执行、如果迩想查看效果、请打开http://hostip:9090来查看 ./uwsgi --http :9090 --wsgi-file ../program/py_script/return_enviorn.py     关于uWSGI最简单的形式如下、其中的environ包含了各种从客户端带来的信息 # This is our application object. It could have any name,# except when using mod_wsgi where it must be applicationdef application( # It accepts two arguments: # environ points to a dictionary containing CGI like environment variables # which is filled by the server for each received request from the client environ,# start_response is a callback function supplied by the server # which will be used to send the HTTP status and headers to the server start_response):# build the response body possibly using the environ dictionary response_body The request method was %s % environ[HTTP_USER_AGENT]# HTTP response code and message status 200 OK# These are HTTP headers expected by the client. # They must be wrapped as a list of tupled pairs: # [(Header name, Header value)]. response_headers [(Content-Type, text/plain), (Content-Length, str(len(response_body)))]# Send them to the server using the supplied function start_response(status, response_headers)# Return the response body. # Notice it is wrapped in a list although it could be any iterable. return [response_body] 假如莪们把environ[HTTP_USER_AGENT]改成environ、则是输出所有信息、比如这样   1 The request method was { 2 SCRIPT_NAME: , 3 REQUEST_METHOD: GET, 4 UWSGI_ROUTER: http, 5 SERVER_PROTOCOL: HTTP/1.1, 6 QUERY_STRING: , 7 HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; SE 2.X MetaSr 1.0), 8 HTTP_CONNECTION: Keep-Alive, 9 SERVER_NAME: M12-129,10 REMOTE_ADDR: 172.16.1.3,11 HTTP_THREADID: 4416,12 wsgi.url_scheme: http,13 SERVER_PORT: 9090,14 uwsgi.node: M12-129,15 wsgi.input: uwsgi._Input object at 0x1a895b0,16 HTTP_HOST: 172.16.3.129:9090,17 wsgi.multithread: False,18 REQUEST_URI: /,19 HTTP_ACCEPT: image/jpeg, application/x-ms-application, image/gif, application/xamlxml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*,20 wsgi.version: (1, 0),21 wsgi.run_once: False,22 wsgi.errors: open file wsgi_input, mode w at 0x7f5bf60644b0,23 wsgi.multiprocess: False,24 HTTP_ACCEPT_LANGUAGE: zh-CN,25 uwsgi.version: 0.9.8.6,26 wsgi.file_wrapper: built-in function uwsgi_sendfile,27 HTTP_ACCEPT_ENCODING: gzip, deflate,28 PATH_INFO: /29 }  可是看出、这个environ里面所包含的信息和CGI的环境变量非常的相似、但又有所不同、比如有包括了UWSGI的路由形式、UWSGI的多线程和多进程情况等等、应该可以说是CGI环境变量的加强版本     1 #!/usr/bin/env python 2 3 from wsgiref.simple_server import make_server 4 from cgi import parse_qs, escape 5 6 html 7 html 8 body 9 form methodget actionparsing_get.wsgi10 p11 Age: input typetext nameage12 /p13 p14 Hobbies:15 input namehobbies typecheckbox valuesoftware Software16 input namehobbies typecheckbox valuetunning Auto Tunning17 /p18 p19 input typesubmit valueSubmit20 /p21 /form22 p23 Age: %sbr24 Hobbies: %s25 /p26 /body27 /html28 29 def application(environ, start_response):30 31 # Returns a dictionary containing lists as values.32 d parse_qs(environ[QUERY_STRING])33 34 # In this idiom you must issue a list containing a default value.35 age d.get(age, [])[0] # Returns the first age value.36 hobbies d.get(hobbies, []) # Returns a list of hobbies.37 38 # Always escape user input to avoid script injection39 age escape(age)40 hobbies [escape(hobby) for hobby in hobbies]41 42 response_body html % (age or Empty,43 , .join(hobbies or [No Hobbies]))44 45 status 200 OK46 47 # Now content type is text/html48 response_headers [(Content-Type, text/html),49 (Content-Length, str(len(response_body)))]50 start_response(status, response_headers)51 52 return [response_body]53 54 httpd make_server(localhost, 8051, application)55 # Now it is serve_forever() in instead of handle_request().56 # In Windows you can kill it in the Task Manager (python.exe).57 # In Linux a Ctrl-C will do it.58 httpd.serve_forever()      其中第32行的函数parse_qs()是个解析网页请求参数为数组的冬冬、具体的用法可以看下面的这个例子 1 import urlparse2 qsdata testtesttest2test2test2test33 qs urlparse.parse_qs(qsdata)4 print qs 输出 {test: [test], test2: [test2, test3]}  转载于:https://www.cnblogs.com/klobohyz/archive/2011/12/14/2287181.html
http://www.zqtcl.cn/news/54221/

相关文章:

  • 成都网站设计报告书咨询公司排名前十
  • 网站安全软件心理咨询网站开发
  • 青岛仿站定制模板建站移动端网站制作的有哪些要求
  • 佛山网站建设公司88天津外贸营销型网站建设
  • 漫画网站开发源码国际最新新闻热点事件
  • 东莞食品公司东莞网站建设wordpress后台样式
  • 永州网站开发公司现在那个网站做宣传有效果
  • 广安市建设局官方网站网站建设预览
  • asp 企业网站管理系统学校网站管理与建设办法
  • 可视化域名网站模块被删了房屋网
  • 备案公司网站建设方案书wordpress文章的表是什么
  • 山西手动网站建设推广杭州网站建设案例
  • 长春网站建设工作深圳工程交易中心网
  • 用asp.net做购物网站wordpress编码修改
  • 网站建设包括哪方面织梦做的网站打开空白
  • 东宁做木耳招工人网站信息流广告代运营公司
  • 深圳双区建设石家庄seo网站优化电话
  • 建设一个网站用什么搭建我想开个网站
  • 因网站建设关闭的公告网站建设服务费进入什么科目
  • 别人给公司做的网站字体侵权吗南京英文网站制作
  • 酒泉手机网站建设广州番禺发布网
  • 怎么搭建视频网站在线是免费生成器
  • 公司网站建设方案拓扑图建站公司服务
  • 西安网站建设多钱东营港经济开发区
  • 南通网站开发公司精准网络推广
  • 制作一个学校门户网站哪个网站有摄影作品
  • 安徽安能建设集团网站设计公司工作室创业规划
  • 上海嘉定网站旅游网站模板免费下载
  • 做网站能挣钱吗wordpress伪静态 iis
  • 58同城网站建设排名在信息发布网站建设外链