Accessing global variable in view using context processor in Django
问题 Assuming I have a context processor: def title(request): return {'titles': 'mytitle'} I can access this variable in template as {{ titles }} . But how can I do so in a view? def myview(request): print request.titles doesn't seem to work - 'WSGIRequest' object has no attribute 'titles' Or maybe there is a better approach (than context processors) to have global variables accessible in both views and templates? Thanks in advance. 回答1: Context processors aren't in any way global variables. They