django全局响应超时中间件
django-response-timeout的Python项目详细描述
django-response-timeout允许您全局设置 所有回应。它提供了一种方法来覆盖 djangoper site缓存中间件。
安装
安装非常简单:
pip install django-response-timeout
设置
添加response_timeout.middleware.SetCacheTimeoutMiddleware并放置它 在dumper.middleware.UpdateCacheMiddleware之后,它将设置 缓存响应的头时间。
MIDDLEWARE_CLASSES=('django.middleware.cache.UpdateCacheMiddleware','response_timeout.middleware.SetCacheTimeoutMiddleware','django.middleware.common.CommonMiddleware','django.middleware.cache.FetchFromCacheMiddleware',)
然后将response_cache_seconds设置为每页应该的秒数 缓存在前端。
django文档没有连贯地描述您的中间件 应该是有序的,但是this stackoverflow讨论做得很好。
贡献
如果您发现问题或希望看到支持的功能,请转到 发布部分并报告。别生气,去吧,去吧!
要以任何形式贡献代码,请分叉存储库并在本地克隆它。 为您的功能创建新分支:
git commit -b feature/whatever-you-like
然后确保所有测试都通过(并为任何新功能编写新的测试):
pip install -e . pip install -r requirements-dev.txt django-admin.py test --settings=test.settings
检查readme.rst是否正确:
restview --long-description
然后将完成的特性推送到github,并从分支打开一个pull请求。
新版本
创建新版本:
- 将更改添加到CHANGES.txt
- 在setup.py 中更改版本
- python setup.py register
- python setup.py sdist upload