-
-
Save Akash1362000/7b547e5e2283d88994b779f1c2585694 to your computer and use it in GitHub Desktop.
Function Based Middleware in Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def simple_middleware(get_response): | |
# One-time configuration and initialization. | |
def middleware(request): | |
# Code to be executed for each request before | |
# the view (and later middleware) are called. | |
response = get_response(request) | |
# Code to be executed for each request/response after | |
# the view is called. | |
return response | |
return middleware |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment