Django
How to add a request global variable in Django
In Flask, there is g object. in Django, actually you can directly set attribute to meet the requirement. Just like Django set user for request request.user = ... , you can init request.g = {}, then request.g["hello"] = 1.
Last updated
Was this helpful?