当前位置: 首页 > 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.pierceye.com/news/54221/

相关文章:

  • 温州cms建站系统网站建设东莞公司
  • 搜索不到网站的关键词去什么网站可以做ctf的题目
  • 用wordpress建一个网站吗仿煎蛋wordpress
  • 网站建设什么语言比较好本地wordpress如何迁移
  • 张家港质监站网址erp管理系统软件有哪些
  • 专业做公司网站合肥建筑材料市场信息价官网
  • 微信开发人温州优化售后
  • 蓝色网站模版企业年金查询个人账户查询
  • 龙岗网站优化凡客诚品是什么牌子
  • 网站制作属于什么品牌不属于网站建设方式的是
  • 换空间网站备案吗电商网站活动推广
  • 福州建站服务管理wordpress 小工具开发
  • 网站类网站开发犯罪吗官渡区住房和城乡建设局网站
  • dedecms能做什么网站wordpress 文章倒序
  • 家具营销型网站wordpress cros
  • 如何建设个人网站凡科怎么样做网站服务器配置应该怎么选
  • 广西网站建设推广如何在手机上制作app软件
  • 做网站灰色网站怎么判刑好用的软件下载网站
  • 做电影网站详细教程wordpress 数据同步
  • 中国建设银行租赁网站wordpress授权破解
  • 装饰公司响应式网站建设案例网页建设的公司
  • 网站首页设计图片简约happytug wordpress
  • 网站的改版怎么做石家庄新闻综合频道节目回看
  • o2o网站建设咨询做网站怎么接单
  • 浙江标力建设集团网站深圳市龙华区房价
  • 衡水建设局网站wordpress 主题 名站
  • 网站设计字体最好用网络推广加盟
  • 外贸网站建设模板指定网站建设前期规划方案
  • 网站建设一条龙包括哪些服务wordpress登陆口
  • html5做网站优势网站pc端网址和手机端网址建设