Skip to content

Instantly share code, notes, and snippets.

@kelp404
Created July 16, 2014 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelp404/e5f1079c3910fd4f2238 to your computer and use it in GitHub Desktop.
Save kelp404/e5f1079c3910fd4f2238 to your computer and use it in GitHub Desktop.
GlobalMiddleware in Python django
import threading
g = threading.local()
class GlobalMiddleware(object):
"""
Global variable.
"""
def process_request(self, request):
g.request = request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment