def custom_proc(request):
"A context processor that provides 'app', 'user' and 'ip_address'."
return {
'app': 'My app',
'user': request.user,
'ip_address': request.META['REMOTE_ADDR']
}
above code is my code. a request Context. i write this code in a file context_processors.py.
and follow code is in settings.py file:
'context_processors': [
'django.template.context_processors.custom_proc',
how to use the context processor in the view.py file?
return render(request,'template1.html',
{'message': 'I am view 1.'})```
enter code here