WSGI学习系列Paste
Paste has been under development for a while, and has lots of code in it.
The code is largely decoupled except for some core functions shared by many parts of the code.
Those core functions are largely replaced in WebOb, and replaced with better implementations.
The future of these pieces is to split them into independent packages, and refactor the internal Paste dependencies to rely instead on WebOb.
paste.httpserver
# Use paste httpserver
from paste import httpserver
httpserver.serve(application, host='127.0.0.1', port=8000)
paste.deploy
murano-paste.ini is as follows.
[pipeline:murano]
pipeline = versionnegotiation faultwrap authtoken context rootapp [filter:context]
paste.filter_factory = murano.api.middleware.context:ContextMiddleware.factory #For more information see Auth-Token Middleware with Username and Password
#http://docs.openstack.org/developer/keystone/configuringservices.html
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory [composite:rootapp]
use = egg:Paste#urlmap
/: apiversions
/v1: apiv1app [app:apiversions]
paste.app_factory = murano.api.versions:create_resource [app:apiv1app]
paste.app_factory = murano.api.v1.router:API.factory [filter:versionnegotiation]
paste.filter_factory = murano.api.middleware.version_negotiation:VersionNegotiationFilter.factory [filter:faultwrap]
paste.filter_factory = murano.api.middleware.fault:FaultWrapper.factory
(1) pipeline
[pipeline:murano]
pipeline = versionnegotiation faultwrap authtoken context rootapp
pipeline is used when you need apply a number of filters.
It takes one configuration key pipeline (plus any global configuration overrides you want).
pipeline is a list of filters ended by an application.
These filters are defined by the ini file.
rootapp is a Murano application.
(2) filter_factory
Filters are callables that take a WSGI application as the only argument, and return a “filtered” version of that application.
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
For example, authtoken filter is implemented by keystonemiddleware.auth_token:filter_factory function.
Before visiting the Murano Application interface, filter_factory function will call the keystone client to check the user or tenant authorization.
(3) composite
[composite:rootapp]
use = egg:Paste#urlmap
/: apiversions
/v1: apiv1app
The default site directory is implemented by apiversions app.
The /v1 directory is implemented by apiv1app app.
(4) app_factory
[app:apiv1app]
paste.app_factory = murano.api.v1.router:API.factory
The application is the most common. You define one like:
def app_factory(global_config, **local_conf):
return wsgi_app
The global_config is a dictionary, and local configuration is passed as keyword arguments.
The function returns a WSGI application.
apiv1app is implemented by murano.api.v1.router:API.factory function.
WSGI学习系列Paste的更多相关文章
- WSGI学习系列多种方式创建WebServer
def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) ...
- WSGI学习系列WebOb
1. WSGI Server <-----> WSGI Middleware<-----> WSGI Application 1.1 WSGI Server wsgi ser ...
- WSGI学习系列WSME
Introduction Web Services Made Easy (WSME) simplifies the writing of REST web services by providing ...
- WSGI学习系列eventlet.wsgi
WSGI是Web Service Gateway Interface的缩写. WSGI标准在PEP(Python Enhancement Proposal)中定义并被许多框架实现,其中包括现广泛使用的 ...
- WSGI学习系列Pecan
Pecan Introduce Pecan是一个轻量级的基于Python的Web框架, Pecan的目标并不是要成为一个“full stack”的框架, 因此Pecan本身不支持类似Session和D ...
- Docker学习系列(一):windows下安装docker(转载)
本文目录如下: windows按照docker的基本要求 具体安装步骤 开始使用 安装远程连接工具连接docker 安装中遇到的问题 Docker的更新 Docker中的jupyter windows ...
- 分布式学习系列【dubbo入门实践】
分布式学习系列[dubbo入门实践] dubbo架构 组成部分:provider,consumer,registry,monitor: provider,consumer注册,订阅类似于消息队列的注册 ...
- Entity Framework Code First学习系列目录
Entity Framework Code First学习系列说明:开发环境为Visual Studio 2010 + Entity Framework 5.0+MS SQL Server 2012, ...
- WCF学习系列汇总
最近在学习WCF,打算把一整个系列的文章都”写“出来,包括理论和实践,这里的“写”是翻译,是国外的大牛写好的,我只是搬运工外加翻译.翻译的不好,大家请指正,谢谢了.如果觉得不错的话,也可以给我点赞,这 ...
随机推荐
- POJ 2836 Rectangular Covering (状压DP)
题意:平面上有 n (2 ≤ n ≤ 15) 个点,现用平行于坐标轴的矩形去覆盖所有点,每个矩形至少盖两个点,矩形面积不可为0,求这些矩形的最小面积. 析:先预处理所有的矩形,然后dp[s] 表示 状 ...
- 使用JMeter的Java Sampler轻松定制自己的benchmark
做性能测试,接口测试,非常好 转自 http://www.iteye.com/topic/1123432 以前碰到更多的是WEB APP的性能测试,也许用得最多的是Loadrunner, Web S ...
- C++11新标准:auto关键字
一.auto意义 编程时常常需要把表达式的值赋给变量,这就要求在声明变量的时候清楚地知道表达式的类型,然后要做到这一点并非那么容易.为了解决这个问题,C++11新标准引入了auto类型说明符,用它就能 ...
- seleniumIDE是Firefox的录制功能使用
selenium第二课(脚本录制seleniumIDE的使用) 转自:https://www.cnblogs.com/hustar0102/p/5906958.html 一.Selenium也具有录制 ...
- Python3中装饰器的使用
较为复杂的装饰器使用: user,passwd = 'hjc',111111 def auth(type): print('auth type:',type) def outwrapper(func) ...
- 692. Top K Frequent Words
Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted b ...
- 基于vue框架项目开发过程中遇到的问题总结(二)
1.mouseup事件丢失 查看了网上资料,造成mouseup事件丢失有两种原因: (1)触发了浏览器的drag事件 (2)由于鼠标离开了操作的区域,触发了mouseleave事件导致mouseup丢 ...
- ASP.NET-GridView之固定表数据滚动
有时候,在线Web开发时,需要显示的数据往往会超过我们规定的表格长度,所以为了方便显示大量数据,为了美观,这里提出了两种显示数据方式. ①可以滚动显示数据但是表头未能获取 效果显示 前端DEMO &l ...
- VS报错:DEBUG Assertion Failed!
使用vs2010时,遇到如下错误 然后点击继续后: 点击终止: 观察变量: 根据提示发现,有可能是断点问题,于是猜想可能是指针的错误. google发现,这种错误可能是由于指针的释放跨越了模块.比如我 ...
- mysql远程访问被禁止
远程连接Mysql服务器的数据库,错误代码是1130,ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL ...