使用Werkzeug在Thread Local Storage中存储当前请求
项目描述
这是一个从: https://github.com/sorl/django-tls 分支出来的项目。使用Werkzeug在Thread Local Storage中存储当前请求。
安装
pip install git+https://github.com/rvanlaar/django-tls
配置
# settings.py MIDDLEWARE = [ 'tls.TLSRequestMiddleware', ... ]
使用
from tls import request # do something dangerous and useful with current request object
担心安全问题?那么请阅读这个 线程。