2 from threading import local
4 from django.utils._threading_local import local
7 _thread_locals = local()
9 def get_current_request():
10 return getattr(_thread_locals, 'request', None)
13 class ThreadLocalMiddleware:
14 def process_request(self, request):
15 _thread_locals.request = request