What is the difference between Context, Request Context in django?
Why do we need context processors?
What is the difference between Context, Request Context in django? Why do we need
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
RequestContextsimply goes through yourTEMPLATE_CONTEXT_PROCESSORSsetting and adds variables in addition to the ones you explicitly pass to the context class.The context processors are literally just a function that accepts
requestas the first argument and returns a dictionary to be added into the context.Why do you need them? Because some very common operations like adding the currently logged in user or
STATIC_URLvariables to the context would get highly repetitive if not automated.