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

商城网站建设策划方案wordpress ie6 内核

商城网站建设策划方案,wordpress ie6 内核,免费游戏不用登录的,网站开发计划表bottle是一个轻量级的pythonweb框架#xff0c; 可以适配各种web服务器#xff0c;包括python自带的wsgiref(默认)#xff0c;gevent#xff0c; cherrypy#xff0c;gunicorn等等。bottle是单文件形式发布#xff0c;源码在这里可以下载#xff0c;代码量不多#xff…bottle是一个轻量级的pythonweb框架 可以适配各种web服务器包括python自带的wsgiref(默认)gevent cherrypygunicorn等等。bottle是单文件形式发布源码在这里可以下载代码量不多可以用来学习web框架。这里也有官方文档的中文翻译。     首先我们来运行一下bottle的hello worldfrom bottle importrunif __name__ __main__:defapplication(environ, start_response):start_response(200 OK, [(Content-Type, text/html)])return [Hello world!]run(hostlocalhost, port8080, appapplication)上面的代码看起来也非常符合wsgi的接口规范。启动改代码可以看到输出         Bottle v0.13-dev server starting up (usingWSGIRefServer())…         Listening on http://localhost:8080/         Hit Ctrl-C to quit.      输出中加粗部分表明使用的web服务器是python自带的wsgiref。也可以使用其他web server比如gevent前提是需要安装gevent修改后的代码如下from bottle importrunimportgevent.monkeygevent.monkey.patch_all()if __name__ __main__:defapplication(environ, start_response):start_response(200 OK, [(Content-Type, text/html)])return [Hello world!]run(hostlocalhost, port8080, appapplication, server gevent)通过server关键字指定web服务器为‘gevent’输出的第一行变成了Bottle v0.13-dev server starting up (usingGeventServer())…   不管bottle用什么web服务器启动在浏览器输入127.0.0.1:8080都可以看到       下面介绍bottle中部分类和接口bottle.Bottle     代表一个独立的wsgi应用由一下部分组成routes, callbacks, plugins, resources and configuration。     __call__: Bottle定义了__call__函数, 使得Bottle的实例能成为一个callable。在前文提到web框架(或Application)需要提供一个callbale对象给web服务器bottle提供的就是Bottle实例def __call__(self, environ, start_response):Each instance of :class:Bottle is a WSGI application.return self.wsgi(environ, start_response)下面是Bottle.wsgi函数的核心代码主要调用两个比较重要的函数_handle, _castdefwsgi(self, environ, start_response):The bottle WSGI-interface.try:outself._cast(self._handle(environ))#rfc2616 section 4.3if response._status_code in (100, 101, 204, 304)\or environ[REQUEST_METHOD] HEAD:if hasattr(out, close): out.close()out[]start_response(response._status_line, response.headerlist)return out_handle处理请求最终调用到application 简化后的代码如下1   def_handle(self, environ):2 self.trigger_hook(before_request)3 route, args self.router.match(environ)4 out route.call(**args)5 self.trigger_hook(after_request)6 return out_cast:         标准的wsgi接口对Application的返回值要求严格必须迭代返回字符串。bottle做了一些扩展可以允许App返回更加丰富的类型比如dictFile等。 _cast函数对_handle函数返回值进行处理使之符合wsgi规范bottle.Route     封装了路由规则与对应的回调bottle.RouterA Router is an ordered collection of route-target pairs. It is used to  efficiently match WSGI requests against a number of routes and return the first target that satisfies the request.ServerAdapter     所有bottle适配的web服务器的基类子类只要实现run方法就可以了bottle里面有大量的Web服务器的适配。下表来自官网介绍了bottle支持的各种web服务器以及各自的特性。NameHomepageDescriptioncgiRun as CGI scriptflupRun as FastCGI processgaeHelper for Google App Engine deploymentswsgirefSingle-threaded default servercherrypyMulti-threaded and very stablepasteMulti-threaded, stable, tried and testedrocketMulti-threadedwaitressMulti-threaded, poweres PyramidgunicornPre-forked, partly written in CeventletAsynchronous framework with WSGI support.geventAsynchronous (greenlets)dieselAsynchronous (greenlets)fapws3Asynchronous (network side only), written in CtornadoAsynchronous, powers some parts of FacebooktwistedAsynchronous, well tested but… twistedmeinheldAsynchronous, partly written in CbjoernAsynchronous, very fast and written in CautoAutomatically selects an available server adapter可以看到bottle适配的web服务器很丰富。工作模式也很全面有多线程的(如paste)、有多进程模式的(如gunicorn)、也有基于协程的(如gevent)。具体选择哪种web服务器取决于应用的特性比如是CPU bound还是IO boundbottle.run     启动wsgi服务器。几个比较重要的参数     app wsgi application即可以是bottle.Bottle 也开始是任何满足wsgi 接口的函数     server wsgi http server字符串     hostport 监听端口          核心逻辑     ServerAdapter.run(app)。   最后bottle源码中有一些使用descriptor的例子实现很巧妙值得一读前文也有介绍。   referenceshttp://www.bottlepy.org/docs/dev/https://raw.githubusercontent.com/bottlepy/bottle/master/bottle.pyhttp://blog.csdn.net/huithe/article/details/8087645http://simple-is-better.com/news/59http://www.bottlepy.org/docs/dev/deployment.html#server-optionshttp://blog.rutwick.com/use-bottle-python-framework-with-google-app-engine
http://www.yutouwan.com/news/294286/

相关文章:

  • 浙江省大成建设集团有限公司网站铜陵电子商务网站建设
  • 一个新网站关键词怎么做SEO优化一般通过后补贴什么时候到
  • 深圳提供网站建设服务平台app开发公司排行榜做软件的公司
  • 苏州网站制作网络建设公司网站开发的特点
  • 怎样安全做黑色彩票网站官方网站下载水印相机
  • 广西江荣建设工程有限责任公司网站网站友情链接模块
  • 网页制作模板的网站免费中国能源建设集团有限公司子公司
  • 做网站的目标是什么网页布局实例
  • 青海建设厅网站证件查询谷歌网站推广好做吗
  • 做阿里巴巴网站卖货咋样门户网站前台页面
  • 新网站建设咨询如何选择o2o网站建设
  • 旅游网站设计源码个人求职网站设计
  • 360网站卖东西怎么做的自己做网站app
  • 股票做空网站网站建设合同的验收表
  • 百度站长平台怎么验证网站自助建站系统搭建
  • 一站式企业网站建设iis服务器网站301重定向怎么做
  • 邵武网站建设昆明seo和网络推广
  • 地板网站代码网站开发设计的技术
  • 佛山网站建设官网个人博客排名
  • 凡科建站登录入口vultr怎么建设影视网站
  • 企业如何建站做网站张家口
  • 网站水军怎么做网页设计公司哪里会需要翻译
  • 做网站一年大概的盈利大型网站开发考试
  • 云南省建设测量员注册网站淘宝基地网站怎么做
  • 网站自己做余额充值自动扣款wordpress 允许ping
  • asp网站开发视频昆明好的网站开发公司
  • 南阳移动端网站制作cms建站方案
  • 三端互通传奇手游找服网站长春网站设计策划书
  • 河南省建设监理协会官网站无货源电商怎么做新手入门
  • 新建的网站可以百度推广wordpress关闭多版本