2👍
✅
django.core.context_processors.request
only adds the request to the context, see the docs.
Write your won context processor, something like:
from django.conf import settings
def add_site_setting(request):
return {'site_name': settings.SITE_NAME}
Then add that function to TEMPLATE_CONTEXT_PROCESSORS
in your settings.py
Also, I suggest a good habit to get into is using from django.conf import settings
rather than explicitly importing your settings file.
0👍
Not sure what gave you that impression. The request
context processor does exactly what it says on the tin: adds the request to the context processor. There’s nothing that says it will do anything with the SITE_NAME setting – especially as that isn’t even a standard setting.
If you want that to be added by a context processor, then you can write your own – it’ll only be two lines of code.
- [Answered ]-How to avoid code duplication with similar Django model methods?
- [Answered ]-Accessing context_data from dispatch method
- [Answered ]-Django: Limit user's session by time
- [Answered ]-Deploying django project on apache
Source:stackexchange.com