I am defining a function in my context_processor to pass a value from my settings to use in templates. So what is the right way, and more importantly what is the difference?
def baseurl(request):
return {'BASE_URL': settings.BASE_URL}
or
def baseurl(context):
return {'BASE_URL': settings.BASE_URL}
I have always used the first, but have run into a few examples of the second
You are free to call this argument whatever you like but
requestis the most common or clear. From the Django docs: https://docs.djangoproject.com/en/1.4/ref/templates/api/#writing-your-own-context-processorsWhile there is nothing stopping you from naming this argument
contextit would be misleading since it is passed an HttpRequest object.