小型Pyramid扩展,用于重定向URL
项目描述
介绍
pyramid_redirect是一个小型扩展,用于在进一步处理之前重定向Pyramid URL。
安装
只需这样做
pip install pyramid_redirect
或者
easy_install pyramid_redirect
兼容性
pyramid_redirect与pyramid>=1.3和python>=2.7以及python>=3.5兼容。其他版本也可能工作。
文档
用法示例
def main(global_config, **settings): config = Configurator(settings=settings) config.include('pyramid_redirect') # add url redirecting rules... # first parameter is a regular expression # second parameter is the target url config.add_redirect_rule(r'http://example\.com/favicon.ico', r'http://example.com/static/favicon.ico') config.add_redirect_rule( r'http://example\.com/gallery/(?P<subpath>.*)', r'http://example.com/root/%(subpath)s', permanent=True, headers={'X-Value': 'foo'} ) # # ... rest of configuration # # return WSGI application instance return config.make_wsgi_app()
查看测试以获取更多示例。
如果您使用structlog,请将以下配置设置添加到您的INI文件中,以启用类似structlog的日志记录
pyramid_redirect.structlog = true
发布
更新CHANGES.rst。
更新setup.py版本。
运行bin/longtest。
运行bin/mkrelease -d pypi。
我们正在招聘!
在Niteo,我们定期向开源社区贡献。如果你也在这样做,我们很乐意邀请你加入我们的团队!
变更
0.4
支持设置响应头。
使用Black格式化代码。
重命名niteoweb -> teamniteo。 [am-on]
0.3
添加永久(301)重定向选项。 [am-on]
0.2
支持structlog。 [zupo]
0.1.1
棕色袋发布。 [zupo]
0.1
首次发布。基于https://pypi.python.org/pypi/pyramid_rewrite。 [zupo]
项目详情
关闭
pyramid_redirect-0.4.tar.gz的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | a008afdd452c07e98c56cb04eb6e8fa9cf3d8754bafc624be4cb085f64cb7da7 |
|
MD5 | 0e08960c5c08f49cc3d651b3f65f924f |
|
BLAKE2b-256 | bf8f603c44f9ed620904a26cb1bbc693ffeb338792f2d4688ee3cb9dea807597 |
关闭
pyramid_redirect-0.4-py3-none-any.whl的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 2e43aca7c364137b8d33c07578813f6612d775b6d87dde5e555bdf5fd8aaa752 |
|
MD5 | 3962da0746a68f46775815084b4e418a |
|
BLAKE2b-256 | aab2465752442f00170b013d0e01a800b68476120401ed318fc89771381f4108 |