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,打算把一整个系列的文章都”写“出来,包括理论和实践,这里的“写”是翻译,是国外的大牛写好的,我只是搬运工外加翻译.翻译的不好,大家请指正,谢谢了.如果觉得不错的话,也可以给我点赞,这 ...
随机推荐
- 国外物联网平台(2):微软Azure IoT
国外物联网平台(2)——微软Azure IoT 马智 平台定位 连接设备.其它 M2M 资产和人员,以便在业务和操作中更好地利用数据. 连接 IoT 设备 将所有设备连接到云,从这些设备接收大规模数据 ...
- C#中的多线程 - 高级多线程
1非阻塞同步Permalink 之前,我们描述了即使是很简单的赋值或更新一个字段也需要同步.尽管锁总能满足这个需求,一个存在竞争的锁意味着肯定有线程会被阻塞,就会导致由上下文切换和调度的延迟带来的开销 ...
- 验证视图状态MAC失败的解决办法
在网上搜寻了很久看了很多关于MAC验证视图状态失败的解决方法.大部分人都说是在页里或web.config里加 EnableEventValidation="false" Enabl ...
- SQL server 提取字符中第一次和最后一次出现的数字
CREATE FUNCTION [dbo].[StringExtractNumber(FirstOrLast)](@address nvarchar(max),@firstOrLast INT) re ...
- VS2015无法创建C++工程解决方法!!
VS2015默认安装时候没有安装C++,如果安装C++没有选择全部C++项目,则无法创建C++工程,在控制面板里的删除程序中,选择VS2015,随后选择修改,把C++项目都选择上就可以了,这样安装完毕 ...
- laravel安装[转https://laravelacademy.org/post/9528.html]
Laravel 框架对PHP版本和扩展有一定要求,不过这些要求 Laravel Homestead 都已经满足了,不过如果你没有使用 Homestead 的话(那真是一件很遗憾的事情),有必要了解下这 ...
- [SinGuLaRiTy] NOIP膜你赛-Day 1
[SinGuLRiTy-1022] Copyright (c) SinGuLaRITy 2017. All Rights Reserved. 对于所有题目:Time Limit:1s || Memo ...
- luogu P3811线性求逆元
首先扩O:T了一个点(因为上界松),83分. #include <cstdio> using namespace std; int n, p; void exgcd(int a, int ...
- jQuery的ajax实现文件上传大小限制
用jquery的ajax实现简单的文件上传功能,并且限制文件大小,先上代码. <!DOCTYPE html> <html> <head> <meta char ...
- load xml with xls
you can study xls language in the below link : http://www.w3schools.com/xsl/xsl_languages.asp CSS = ...