Django 1.4: Why is my context processor not working?

django, django-1.4, django-templates

Solution

Just for kicks, would you consider specifying that setting the usual way:

- global_settings.TEMPLATE_CONTEXT_PROCESSORS += (
+ TEMPLATE_CONTEXT_PROCESSORS = (                                                 
+     'django.contrib.auth.context_processors.auth',                                   
+     'django.core.context_processors.debug',                                       
+     'django.core.context_processors.i18n',                                        
+     'django.core.context_processors.media',                                       
+     'django.core.context_processors.static',                                      
+     'django.contrib.messages.context_processors.messages',
     'myapp.processors.currentPath',
     'django.core.context_processors.request',
 )

This could eliminate your (useful-looking!) reference to `global_settings` as a source of the issue.

Secondly, if you run

manage.py shell

does

from myapp.processors import currentPath

work? Your project structure seems a litte quirky (I haven't seen a context processors in the same directory as `settings.py` before; my `context.py` is in the same directory as a `models.py`, which I understand should usually not be the same directory as `settings.py`).

(Converted from comment to answer at OP's request)

Problem

I recently upgraded a project from Django 1.3 to 1.4, and that seems to have broken my context processor. In `myapp/myapp/processors.py`: ``` def currentPath(request): return {'current_path': request.get_full_path()} ``` In `myapp/myapp/settings.py`: ``` from django.conf import global_settings global_settings.TEMPLATE_CONTEXT_PROCESSORS += ( 'myapp.processors.currentPath', 'django.core.context_processors.request', ) ``` In any template, `{{ current_path }}` is expected -- and did, until the upgrade, return the current path. Now, it is not getting processed at all. I'm absolutely stuck here.

Original source