are there any examples on how to use Deliverance as a middleware [1] into Django?
Thanks,
SimO
[1] http://packages.python.org/Deliverance/modules/middleware.html
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately it’s not easy, because Deliverance’s internals rely heavily on WSGI and WebOb, so there’s no straightforward way to transform a Django Response.
Your best bet is transforming the response after it leaves Django entirely. One way to do that is http-proxying to Django with
deliverance-proxy. Another is hooking up Deliverance as a WSGI middleware. For example, if you’re running Django with mod_wsgi, something like this might work in your .wsgi file: