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,打算把一整个系列的文章都”写“出来,包括理论和实践,这里的“写”是翻译,是国外的大牛写好的,我只是搬运工外加翻译.翻译的不好,大家请指正,谢谢了.如果觉得不错的话,也可以给我点赞,这 ...
随机推荐
- jquery ajax 分页2
/* * 分页 $("#divPager").flexipager * 2015.03.17 */ //初始化列表默认属性 (function($) { $.addFlex = f ...
- jQuery 插件开发——countdown(倒计时)
故事背景:按照惯例,先写下故事背景,其实也是再次汇报下最近开发情况的.做电商的都知道,这是个活动季啊,双十一.双十二.元旦....各种啊..其实说这么多就是想表达最近比较忙.呵呵^_^,正好今天抽点空 ...
- Arcgis android 10.2安装方法
请仔细对照博文做!!! 将arcgis android 10.2的压缩包解压 arcgis android 10.2下载地址http://pan.baidu.com/s/1sj2LKO9 Help-& ...
- 抽象类(abstract)【转】
抽象类(abstract) abstract修饰符可以和类.方法.属性.索引器及事件一起使用.在类声明中使用abstract修饰符以指示某个类只能是其它类的基类.标记为抽象或包含在抽象类中的成员必须通 ...
- sqlserver清楚文本中的换行符
REPLACE(@string,CHAR(13)+CHAR(10),char(32))
- javascript 设计模式实践之策略模式--输入验证
博客地址:http://www.cnblogs.com/kongxianghai/p/4985122.html,写的挺好的推荐下!
- java java启动方式
java启动方式 两种方案: 1.守护进程方式启动: java –jar命令: 例如:C:\eclise\work\test.jar C:\eclise\work\test.java 打开dos:输 ...
- luogu2257 YY的GCD--莫比乌斯反演
link 给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, y)有多少对 多组数据T = 10000 N, M <= 10000000 ...
- IIS反向代理
- IDEA 中 使用 git(Git)
GitLab GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务.安装方法是参考GitLab在GitHub上的Wiki页面. Git Git( ...