用于重定向URL的小金字塔扩展
pyramid_redirect的Python项目详细描述
简介
金字塔重定向是Pyramid的一个小扩展,用于在进一步处理之前重定向url。
安装
只要做
pip install pyramid_redirect
或
easy_install pyramid_redirect
兼容性
“棱锥”重定向运行时,“棱锥”>;=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) # # ... 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,我们定期为开源社区做出贡献。如果你也这么做,我们想邀请你来join our team!
变化
0.3
- 添加永久(301)重定向选项。 [打开]
0.2
- 支持structlog。 [左坡]
0.1.1
- 棕色袋子释放。 [左坡]
0.1
- 初次发布。基于https://pypi.python.org/pypi/pyramid_rewrite。 [左坡]