[Answered ]-If I set a variable in my middleware, how do I make that available to my views in my views.py?

1👍

If you want it available in your views, you can add anything you want to the request object as that’s ultimately passed down to your views.

request.myvar = 'hello'

1👍

Try

request.aaa = "hello"

and then in your view:

print request.aaa
👤sunn0

Leave a comment