Recently I've started using threading.local() as way for some apis to store and access state for duration of request without having to access request object.
So lets say I have certain code:
_thread_local = threading.local()
_thread_local.theme = 'darkblues'
How long does that _thread_local.theme
variable lasts? Do I have to manually unset it at the end of request in, say, custom middleware? Or it's deleted by Django automatically after it finishes processing request?