将x-powered-by头添加到django站点
django-xpower的Python项目详细描述
Authors: | Justin Quick <justquick@gmail.com> |
---|---|
Version: | 0.1 |
pip install django-xpower==0.1.0
django x power是一个简单的中间件,它将X-Powered-By头添加到任何django站点。
安装
使用pip/easy_install或任何您喜欢的方式安装模块,然后将中间件添加到您的MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES = ( 'xpower.middleware.XPoweredByMiddleware', ... )
配置
在您的设置中,您可以定义X-Powered-By头的内容:
X_POWERED_BY = 'Django'
如果不设置,它将使用默认值'Django/%(version)s 其中,%(version)s替换为您正在使用的django版本。
测试
提供了一个示例项目,因此只要运行./manage.py runserver,就可以 通过运行curl -ihttp://localhost:8000 | head确认它正在工作。 您应该看到这样的内容:
HTTP/1.0 200 OK Date: Wed, 07 Jul 2010 15:40:59 GMT Server: WSGIServer/0.1 Python/2.6.1 Content-Type: text/html X-Powered-By: Django/1.2.1 SVN-13336
交替
标题内容的一些替代方案:
- Ponies with magical powers
- Who the fuck knows
- A series of tubes
- Perfectionists with deadlines
- Opinionated developers